sem_init(&_sem,0,0); // to wait until run thread is initialized
pthread_t traceThread;
- int bid;
+ int bid = 0;
int re2 = pthread_create(&traceThread, NULL,
FileTraceCollector::run, (void *)bid);
sem_wait(&_sem);
#ifndef WNT
#include <dlfcn.h>
#else
+#include <windows.h>
#endif
//#define _DEVDEBUG_
}
else // --- try a dynamic library
{
- void* handle;
#ifndef WNT
+ void* handle;
string impl_name = string ("lib") + traceKind
+ string("TraceCollector.so");
handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
#else
+ HINSTANCE handle;
string impl_name = string ("lib") + traceKind + string(".dll");
- handle = dlopen( impl_name.c_str() , 0 ) ;
+ handle = LoadLibrary( impl_name.c_str() );
#endif
if ( handle )
{
typedef BaseTraceCollector * (*FACTORY_FUNCTION) (void);
+#ifndef WNT
FACTORY_FUNCTION TraceCollectorFactory =
(FACTORY_FUNCTION) dlsym(handle, "SingletonInstance");
- char *error ;
- if ( (error = dlerror() ) != NULL)
- {
+#else
+ FACTORY_FUNCTION TraceCollectorFactory =
+ (FACTORY_FUNCTION)GetProcAddress(handle, "SingletonInstance");
+#endif
+ if ( !TraceCollectorFactory )
+ {
cerr << "Can't resolve symbol: SingletonInstance" <<endl;
- cerr << "dlerror: " << error << endl;
- assert(error == NULL); // to give file and line
- exit(1); // in case assert is deactivated
+#ifndef WNT
+ cerr << "dlerror: " << dlerror() << endl;
+#endif
+ exit( 1 );
}
_myThreadTrace = (TraceCollectorFactory) ();
}
#define _SALOME_TESTCOMPONENT_I_HXX_
#include <iostream>
+
+#include "SALOME_Component_i.hxx"
+
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_TestComponent)
-#include "SALOME_Component_i.hxx"
class Engines_TestComponent_i:
public POA_Engines::TestComponent,