source: Sophya/trunk/SophyaLib/SysTools/pdlmgr.h@ 1929

Last change on this file since 1929 was 1900, checked in by ansari, 24 years ago

Portage sous Mac OS X - Reza 15/02/2002

File size: 1.2 KB
Line 
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#elif defined(Darwin)
15#include </sw/include/dlfcn.h>
16#else
17#include <dlfcn.h>
18#endif
19
20namespace SOPHYA {
21
22typedef void (* DlFunction) (void);
23
24//! Dynamic Link Manager.
25class PDynLinkMgr {
26public:
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
38protected :
39 static string& GetTmpDir();
40 static int numSO;
41 static string* tmpDir;
42
43#if defined(HPUX)
44 shl_t dlhandle;
45#else
46 void * dlhandle;
47#endif
48 string soName;
49 bool copy;
50};
51
52} // namespace SOPHYA
53
54#endif
Note: See TracBrowser for help on using the repository browser.