| Rev | Line |  | 
|---|
| [219] | 1 | // This may look like C code, but it is really -*- C++ -*- | 
|---|
|  | 2 | // Gestionnaire de lien dynamique   -   R. Ansari 12/98 | 
|---|
|  | 3 | // LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA | 
|---|
|  | 4 |  | 
|---|
|  | 5 | #ifndef PDYNLINKMGR_SEEN | 
|---|
|  | 6 | #define PDYNLINKMGR_SEEN | 
|---|
|  | 7 |  | 
|---|
| [241] | 8 | #include "machdefs.h" | 
|---|
| [219] | 9 | #include <string> | 
|---|
|  | 10 |  | 
|---|
|  | 11 |  | 
|---|
|  | 12 | #if defined(HPUX) | 
|---|
|  | 13 | #include <dl.h> | 
|---|
| [1796] | 14 | #elif defined(Darwin) | 
|---|
|  | 15 | #include <mach-o/dyld.h> | 
|---|
| [230] | 16 | #else | 
|---|
|  | 17 | #include <dlfcn.h> | 
|---|
| [219] | 18 | #endif | 
|---|
|  | 19 |  | 
|---|
| [895] | 20 | namespace SOPHYA { | 
|---|
|  | 21 |  | 
|---|
| [219] | 22 | typedef void (* DlFunction) (void); | 
|---|
|  | 23 |  | 
|---|
| [895] | 24 | //! Dynamic Link Manager. | 
|---|
| [219] | 25 | class PDynLinkMgr { | 
|---|
|  | 26 | public: | 
|---|
|  | 27 | // ---- Methodes globales (static) | 
|---|
|  | 28 | static PDynLinkMgr*   BuildFromCFile(string const & fname);  // Compil+link fichier C | 
|---|
|  | 29 | static void           SetTmpDir(string const & path);        // Repertoire des fichiers temporaires | 
|---|
|  | 30 |  | 
|---|
|  | 31 | // ---- Constructeur et methodes | 
|---|
|  | 32 | // Constructeur a partir d'un shared lib - copie en zone temporaire si cp==true | 
|---|
|  | 33 | PDynLinkMgr(string& soname, bool cp=true); | 
|---|
|  | 34 | virtual               ~PDynLinkMgr(); | 
|---|
|  | 35 |  | 
|---|
|  | 36 | virtual DlFunction    GetFunction(string const & funcname); | 
|---|
|  | 37 |  | 
|---|
|  | 38 | protected : | 
|---|
|  | 39 | static string&        GetTmpDir(); | 
|---|
|  | 40 | static int      numSO; | 
|---|
|  | 41 | static string*  tmpDir; | 
|---|
|  | 42 |  | 
|---|
|  | 43 | #if defined(HPUX) | 
|---|
|  | 44 | shl_t dlhandle; | 
|---|
| [1796] | 45 | #elif defined(Darwin) | 
|---|
|  | 46 | NSObjectFileImage shfim; | 
|---|
|  | 47 | NSModule          shmod; | 
|---|
| [480] | 48 | #else | 
|---|
| [230] | 49 | void * dlhandle; | 
|---|
| [219] | 50 | #endif | 
|---|
|  | 51 | string soName; | 
|---|
|  | 52 | bool copy; | 
|---|
|  | 53 | }; | 
|---|
|  | 54 |  | 
|---|
| [895] | 55 | } // namespace SOPHYA | 
|---|
|  | 56 |  | 
|---|
| [219] | 57 | #endif | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.