Update contrib.
1 /** @file ../include/dlfcn.h
5 /** @fn dlopen(const char *filename, int flag)
8 Note: This description also covers the following functions -
9 dlsym() dlerror() dlclose()
12 RTLD_LAZY In the current implementation this flag causes the external function names to be resolved
13 prior to returning from dlopen.
14 RTLD_NOW In the current implementation this flag causes the external function names to be resolved
15 prior to returning from dlopen.
19 RTLD_GLOBAL Symbols exported from this shared library object will not be available
20 for the processing of relocation addresses of any other shared library object.
21 RTLD_LOCAL Symbols exported from this shared library object will not be available
22 for the processing of relocation of addresses in any other shared library object.
25 These functions provide interfaces to the services of the Symbian Loader
26 Server. Operations are provided to load dynamic link libraries (DLLs) into the
27 current process's address space, to obtain the address bindings of symbols
28 exported by the DLLs, and to remove the DLLs from the process's address space
29 when they are no longer required.
31 The dlopen function loads the DLL specified in the filename argument and returns a descriptor if successful. The descriptor
32 returned can be used for later references to the DLL within the calls to dlsym and dlclose. The user side code should not attempt to modify or interpret
33 the value of the descriptor returned by dlopen.
35 If the DLL specified by the filename argument is not in the address space prior to the call to dlopen, it is loaded into the address space. When the DLL is first
36 loaded into the address space constructors of the DLL's global objects
37 are invoked. If the DLL specified by the filename argument has already been placed in the process's address
38 space in a previous call to dlopen, invoking dlopen on the same DLL does not add it a second time, instead the
39 reference count of dlopen operations on that DLL is incremented. Invoking dlclose on the DLL handle decrements the reference count associated
40 with the DLL. When this reference count reaches zero, the DLL is unloaded from
41 the process address space. dlopen returns NULL if path argument is NULL.
43 The mode parameter determines the type of operation performed by dlopen with respect to the symbol address relocations and the visibility
44 of the symbols to other shared libraries loaded by the process. The mode argument has the same effect regardless of its value: It is to
45 resolve all the external function references immediately within dlopen. This is because the external function references are bound
46 immediately by dlopen. For all practical purposes, therefore, the mode parameter's value is assumed to be RTLD_NOW ORed with RTLD_LOCAL.
47 Once a DLL is loaded into the address space, all the symbols exported by it
48 can only be accessed by specifying the handle associated with the DLL. The behaviour
51 mode must contain one of the following values, possibly ORed with additional
52 flags described below: RTLD_LAZY In the current implementation this flag causes the external function names to be resolved
53 prior to returning from dlopen. RTLD_NOW In the current implementation this flag causes the external function names to be resolved
54 prior to returning from dlopen.
56 One of the following flags may be ORed into the mode argument: RTLD_GLOBAL Symbols exported from this shared library object will not be available
57 for the processing of relocation addresses of any other shared library object. RTLD_LOCAL Symbols exported from this shared library object will not be available
58 for the processing of relocation of addresses in any other shared library object.
60 If path argument contains a slash character the entire argument is used
61 as the pathname for the file. C: is considered to be the root and C:\\ is prefixed
62 to the path argument to locate the shared library object. If path contains just the name of the shared library to be loaded, the
63 default location is sys\\bin. The string in the path argument is limited to a maximum of 256 characters.
65 dlopen returns the handle for the dynamic library loaded into the address space
66 of the current process.
68 dlsym function returns the address binding of the symbol associated
69 with the ordinal number. The NULL-terminated character string symbol contains the ordinal number (address lookup is based on ordinal
70 number). The symbols exported by shared DLLs added to the address space by dlopen can be accessed only through calls to dlsym.
72 Symbol names per se are not searched. Instead dlsym locates the ordinal number corresponding to a symbol name and
73 returns the address of the memory location where the symbol is loaded. Ordinal
74 numbers therefore form the basis of the name lookup. Since all handles have
75 to be identified explicitly (that is, as returned by dlopen ), dlsym returns NULL when presented with special handles such as RTLD_NEXT,
76 RTLD_SELF and RTLD_DEFAULT. The implementation treats a NULL handle passed to dlsym as an error and returns NULL.
78 The dlsym function returns a null pointer if the symbol (ordinal) cannot
79 be found and sets an error condition which may be queried with dlerror.
82 returns a null-terminated character string describing the last error that
83 occurred during a call to dlopen, dlsym,
85 If no such error has occurred, dlerror returns a null pointer.
86 At each call to dlerror,
87 the error indication is reset.
88 Thus in the case of two calls
90 where the second call follows the first immediately, the second call
91 will always return a null pointer.
93 The dlclose function deletes a reference to the DLL referenced by handle. If the reference count drops to 0, the DLL is removed from the
94 address space and handle is rendered invalid. Just before removing the DLL from the current
95 process's address space the destructors of the DLL's global objects
96 are invoked. If dlclose is successful it returns 0. Otherwise it returns -1 and sets
97 an error condition that can be interrogated with dlerror.
103 The ordinal numbers associated with the functions in a DLL are in the DLL's
110 @externallyDefinedApi
113 /** @fn dlsym(void * handle, const char * symbol)
116 Refer to dlopen() for the documentation
122 @externallyDefinedApi
126 /** @fn dlerror(void)
128 Refer to dlopen() for the documentation
134 @externallyDefinedApi
137 /** @fn dlclose(void *handle)
139 Refer to dlopen() for the documentation
145 @externallyDefinedApi
152 Modes and flags for dlopen(). Bind function calls lazily.
155 @externallyDefinedApi
161 Modes and flags for dlopen(). Bind function calls immediately.
164 @externallyDefinedApi
170 Modes and flags for dlopen(). Make symbols globally available.
173 @externallyDefinedApi
179 Modes and flags for dlopen(). Opposite of RTLD_GLOBAL, and the default.
182 @externallyDefinedApi
188 Special handle arguments for dlsym()/dlinfo(). Search subsequent objects.
195 /** @def RTLD_DEFAULT
197 Special handle arguments for dlsym()/dlinfo(). Use default search algorithm.
206 Special handle arguments for dlsym()/dlinfo(). Search the caller itself.