7fd59977 |
1 | --Copyright: Matra Datavision 1994 |
2 | |
3 | -- SharedLibrary: OSD_SharedLibrary.cdl |
4 | -- Created: August 30, 1994 |
5 | -- Author: J.P. TIRAULT |
6 | |
7 | class SharedLibrary from OSD |
8 | |
9 | ---Purpose: Interface to dynamic library loader. |
10 | uses LoadMode,Function |
11 | is |
12 | |
13 | Create returns SharedLibrary; |
14 | ---Purpose: Creates a SharedLibrary object with name NULL. |
15 | ---Level: Public |
16 | |
17 | Create (aFilename : CString) returns SharedLibrary; |
18 | ---Purpose: Creates a SharedLibrary object with name aFilename. |
19 | ---Level: Public |
20 | |
21 | SetName (me : out ; aName : CString) |
22 | ---Purpose: Sets a name associated to the shared object. |
23 | ---Level: Public |
24 | is static; |
25 | |
26 | Name (me) |
27 | ---Purpose: Returns the name associated to the shared object. |
28 | ---Level: Public |
29 | returns CString |
30 | is static; |
31 | |
32 | DlOpen (me : out ; Mode : LoadMode) |
33 | ---Purpose: The DlOpen method provides an interface to the |
34 | -- dynamic library loader to allow shared libraries |
35 | -- to be loaded and called at runtime. The DlOpen |
36 | -- function attempts to load Filename, in the address |
37 | -- space of the process, resolving symbols as appropriate. |
38 | -- Any libraries that Filename depends upon are also loaded. |
39 | -- If MODE is RTLD_LAZY, then the runtime loader |
40 | -- does symbol resolution only as needed. |
41 | -- Typically, this means that the first call to a function |
42 | -- in the newly loaded library will cause the resolution of |
43 | -- the address of that function to occur. |
44 | -- If Mode is RTLD_NOW, then the runtime loader must do all |
45 | -- symbol binding during the DlOpen call. |
46 | -- The DlOpen method returns a handle that is used by DlSym |
47 | -- or DlClose. |
48 | -- If there is an error, Standard_False is returned, |
49 | -- Standard_True otherwise. |
50 | -- If a NULL Filename is specified, DlOpen returns a handle |
51 | -- for the main executable, which allows access to dynamic |
52 | -- symbols in the running program. |
53 | ---Level: Public |
54 | |
55 | returns Boolean |
56 | is static; |
57 | |
58 | DlSymb (me; Name : CString) |
59 | ---Purpose: The dlsym function returns the address of the |
60 | -- symbol name found in the shared library. |
61 | -- If the symbol is not found, a NULL pointer is |
62 | -- returned. |
63 | ---Level: Public |
64 | |
65 | returns Function |
66 | is static; |
67 | |
68 | DlClose (me) |
69 | ---Purpose: Deallocates the address space for the library |
70 | -- corresponding to the shared object. |
71 | -- If any user function continues to call a symbol |
72 | -- resolved in the address space of a library |
73 | -- that has been since been deallocated by DlClose, |
74 | -- the results are undefined. |
75 | ---Level: Public |
76 | is static; |
77 | |
78 | DlError (me) |
79 | ---Purpose: The dlerror function returns a string describing |
80 | -- the last error that occurred from |
81 | -- a call to DlOpen, DlClose or DlSym. |
82 | ---Level: Public |
83 | returns CString |
84 | is static; |
85 | |
86 | Destroy (me : in out) |
87 | ---Level: Public |
88 | ---Purpose: Frees memory allocated. |
89 | ---C++: alias ~ |
90 | is static; |
91 | |
92 | |
93 | fields |
94 | |
95 | myHandle : Address; |
96 | myName : PCharacter; |
97 | |
98 | end SharedLibrary from OSD; |
99 | |
100 | |