| Rev | Line |   | 
|---|
| [658] | 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 | 
 | 
|---|
 | 8 | #include "machdefs.h"
 | 
|---|
 | 9 | #include <string>
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | 
 | 
|---|
 | 12 | #if defined(HPUX)
 | 
|---|
 | 13 | #include <dl.h>
 | 
|---|
 | 14 | #else
 | 
|---|
 | 15 | #include <dlfcn.h>
 | 
|---|
 | 16 | #endif
 | 
|---|
 | 17 | 
 | 
|---|
 | 18 | typedef void (* DlFunction) (void);
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 | class PDynLinkMgr {
 | 
|---|
 | 21 | public:
 | 
|---|
 | 22 |   // ---- Methodes globales (static)
 | 
|---|
 | 23 |   static PDynLinkMgr*   BuildFromCFile(string const & fname);  // Compil+link fichier C
 | 
|---|
 | 24 |   static void           SetTmpDir(string const & path);        // Repertoire des fichiers temporaires
 | 
|---|
 | 25 | 
 | 
|---|
 | 26 |   // ---- Constructeur et methodes 
 | 
|---|
 | 27 |   // Constructeur a partir d'un shared lib - copie en zone temporaire si cp==true
 | 
|---|
 | 28 |                         PDynLinkMgr(string& soname, bool cp=true);  
 | 
|---|
 | 29 |   virtual               ~PDynLinkMgr();
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 |   virtual DlFunction    GetFunction(string const & funcname);              
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 | protected :
 | 
|---|
 | 34 |   static string&        GetTmpDir();
 | 
|---|
 | 35 |   static int      numSO;
 | 
|---|
 | 36 |   static string*  tmpDir;
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | #if defined(HPUX)
 | 
|---|
 | 39 |   shl_t dlhandle;
 | 
|---|
 | 40 | #else 
 | 
|---|
 | 41 |   void * dlhandle;
 | 
|---|
 | 42 | #endif
 | 
|---|
 | 43 |   string soName;
 | 
|---|
 | 44 |   bool copy;
 | 
|---|
 | 45 | };
 | 
|---|
 | 46 | 
 | 
|---|
 | 47 | #endif
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.