- // load plugin library
- if(MYDEBUG) MESSAGE("Loading client meshers plugin library ...");
- void* libHandle = dlopen (aClientLibName, RTLD_LAZY);
- if (!libHandle) {
- // report any error, if occured
- const char* anError = dlerror();
- if(MYDEBUG) MESSAGE(anError);
- }
- else {
- // get method, returning hypothesis creator
- if(MYDEBUG) MESSAGE("Find GetHypothesisCreator() method ...");
- typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
- (QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI);
- GetHypothesisCreator procHandle =
- (GetHypothesisCreator)dlsym(libHandle, "GetHypothesisCreator");
- if (!procHandle) {
- if(MYDEBUG) MESSAGE("bad hypothesis client plugin library");
- dlclose(libHandle);
- }
- else {
- // get hypothesis creator
- if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << aHypType);
- aCreator = procHandle(aHypType, aServerLibName, SMESHGUI::GetSMESHGUI());
- if (!aCreator) {
- if(MYDEBUG) MESSAGE("no such a hypothesis in this plugin");
- }
- else {
- // map hypothesis creator to a hypothesis name
- myHypCreatorMap[aHypType] = aCreator;
- }
- }
- }
+ // load plugin library
+ if(MYDEBUG) MESSAGE("Loading client meshers plugin library ...");
+ LibHandle libHandle = LoadLib( aClientLibName.toLatin1().data() );
+ if (!libHandle) {
+ // report any error, if occured
+ if ( MYDEBUG ) {
+#ifdef WIN32
+ const char* anError = "Can't load client meshers plugin library";
+#else
+ const char* anError = dlerror();
+#endif
+ MESSAGE(anError);
+ }
+ }
+ else {
+ // get method, returning hypothesis creator
+ if(MYDEBUG) MESSAGE("Find GetHypothesisCreator() method ...");
+ typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
+ ( const QString& );
+ GetHypothesisCreator procHandle =
+ (GetHypothesisCreator)GetProc(libHandle, "GetHypothesisCreator");
+ if (!procHandle) {
+ if(MYDEBUG) MESSAGE("bad hypothesis client plugin library");
+ UnLoadLib(libHandle);
+ }
+ else {
+ // get hypothesis creator
+ if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << aHypType.toLatin1().data());
+ aCreator = procHandle( aHypType );
+ if (!aCreator) {
+ if(MYDEBUG) MESSAGE("no such a hypothesis in this plugin");
+ }
+ else {
+ // map hypothesis creator to a hypothesis name
+ // BUG 0020378
+ //myHypCreatorMap[aHypType] = aCreator;
+ }
+ }
+ }