Salome HOME
893972143d7e8b9309e0afcf72335c4353b1393d
[modules/yacs.git] / src / bases / DynLibLoaderGNU.hxx
1 #ifndef __DYNLIBLOADERGNU_HXX__
2 #define __DYNLIBLOADERGNU_HXX__
3
4 #include <string>
5
6 namespace YACS
7 {
8   namespace BASES
9   {
10     class DynLibLoaderGNU
11     {
12     private:
13       void *_handleOnLoadedLib;
14       std::string _libName;
15       static const char _extForDynLib[];
16     public:
17       DynLibLoaderGNU(const std::string& libNameWithoutExtension);
18       ~DynLibLoaderGNU();
19       bool isLibFileFindable() const;
20       std::string getLibNameWithoutExt() const;
21       int appendDirInSearchPath(const std::string& dirName);
22       int removeDirInSearchPath(const std::string& dirName);
23       void *getHandleOnSymbolWithName(const std::string& symbName, bool stopOnError=true);
24       static const char *getExtensionForDynLib();
25       bool load();
26       bool reload();
27       bool unload();
28
29     private:
30       void loadLib() { load(); }//! load lib without regarding that _libName is reachable
31       void *resolveSymb(const std::string& symbName, bool stopOnError);
32     };
33   }
34 }
35
36 #endif