Salome HOME
copy tag mergefrom_BR_V0_1_CC_Salome_04oct07
[modules/yacs.git] / src / bases / DynLibLoaderGNU.hxx
diff --git a/src/bases/DynLibLoaderGNU.hxx b/src/bases/DynLibLoaderGNU.hxx
new file mode 100644 (file)
index 0000000..8939721
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef __DYNLIBLOADERGNU_HXX__
+#define __DYNLIBLOADERGNU_HXX__
+
+#include <string>
+
+namespace YACS
+{
+  namespace BASES
+  {
+    class DynLibLoaderGNU
+    {
+    private:
+      void *_handleOnLoadedLib;
+      std::string _libName;
+      static const char _extForDynLib[];
+    public:
+      DynLibLoaderGNU(const std::string& libNameWithoutExtension);
+      ~DynLibLoaderGNU();
+      bool isLibFileFindable() const;
+      std::string getLibNameWithoutExt() const;
+      int appendDirInSearchPath(const std::string& dirName);
+      int removeDirInSearchPath(const std::string& dirName);
+      void *getHandleOnSymbolWithName(const std::string& symbName, bool stopOnError=true);
+      static const char *getExtensionForDynLib();
+      bool load();
+      bool reload();
+      bool unload();
+
+    private:
+      void loadLib() { load(); }//! load lib without regarding that _libName is reachable
+      void *resolveSymb(const std::string& symbName, bool stopOnError);
+    };
+  }
+}
+
+#endif