#include <Standard_ConstructionError.hxx>
+#include <NCollection_DataMap.hxx>
+
#ifdef WNT
#include <windows.h>
#else
const TCollection_AsciiString&,
const TCollection_AsciiString&);
+//This class is workaround of BUG OCC13051 ( SWP13103 )
+//It's stored all loaded libraries for export and unload that in destructor
+class DLL_Collector
+{
+ typedef NCollection_DataMap<TCollection_AsciiString,LibHandle> DLL_Collector_Map;
+ DLL_Collector_Map myMapOfDLL;
+public:
+ DLL_Collector(){};
+ ~DLL_Collector()
+ {
+ DLL_Collector_Map::Iterator Iter( myMapOfDLL );
+ for( ; Iter.More(); Iter.Next() )
+ UnLoadLib( Iter.Value() );
+ }
+
+public:
+ LibHandle LoadDLL( const TCollection_AsciiString& theLibName )
+ {
+ if ( myMapOfDLL.IsBound( theLibName ) )
+ return myMapOfDLL( theLibName );
+
+ LibHandle res = LoadLib( theLibName.ToCString() );
+ if ( res )
+ myMapOfDLL.Bind( theLibName, res );
+
+ return res;
+ }
+};
+
+static DLL_Collector GlobalCollector;
+
//=======================================================================
//function : GetID
//purpose :
return 0;
// load plugin library
- LibHandle anExportLib = LoadLib( aLibName.ToCString() );
+ LibHandle anExportLib = GlobalCollector.LoadDLL( aLibName ); //This is workaround of BUG OCC13051
funcPoint fp = 0;
if ( anExportLib )
fp = (funcPoint)GetProc( anExportLib, "Export" );
int res = fp( aShape, aFileName, aFormatName );
// unload plugin library
- UnLoadLib( anExportLib );
+ //UnLoadLib( anExportLib );
if ( res )
log.SetTouched(Label());