genericopenlibs/openenvcore/include/dlfcn.dosc
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /** @file ../include/dlfcn.h
       
     2 @internalComponent
       
     3 */
       
     4 
       
     5 /** @fn  dlopen(const char *filename, int flag)
       
     6 @param filename
       
     7 @param flag
       
     8 Note: This description also covers the following functions -
       
     9  dlsym()  dlerror()  dlclose() 
       
    10 
       
    11 @code
       
    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.
       
    16 
       
    17 @endcode
       
    18 @code
       
    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.
       
    23 
       
    24 @endcode
       
    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.
       
    30 
       
    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.
       
    34 
       
    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.
       
    42 
       
    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 
       
    49   is outlined below.
       
    50 
       
    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.
       
    55 
       
    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.
       
    59 
       
    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.
       
    64 
       
    65  dlopen returns the handle for the dynamic library loaded into the address space
       
    66 of the current process.
       
    67 
       
    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.
       
    71 
       
    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.
       
    77 
       
    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.
       
    80 
       
    81  The dlerror function
       
    82 returns a null-terminated character string describing the last error that
       
    83 occurred during a call to dlopen, dlsym,
       
    84 or dlclose.
       
    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
       
    89 to dlerror,
       
    90 where the second call follows the first immediately, the second call
       
    91 will always return a null pointer.
       
    92 
       
    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.
       
    98 
       
    99 
       
   100 
       
   101 Notes:
       
   102 
       
   103  The ordinal numbers associated with the functions in a DLL are in the DLL's 
       
   104 .def file.
       
   105 
       
   106 
       
   107  
       
   108 
       
   109 @publishedAll
       
   110 @externallyDefinedApi
       
   111 */
       
   112 
       
   113 /** @fn  dlsym(void *  handle, const char *  symbol)
       
   114 @param handle
       
   115 @param symbol
       
   116 Refer to  dlopen() for the documentation
       
   117 
       
   118 
       
   119  
       
   120 
       
   121 @publishedAll
       
   122 @externallyDefinedApi
       
   123 */
       
   124 
       
   125 
       
   126 /** @fn  dlerror(void)
       
   127 
       
   128 Refer to  dlopen() for the documentation
       
   129 
       
   130 
       
   131  
       
   132 
       
   133 @publishedAll
       
   134 @externallyDefinedApi
       
   135 */
       
   136 
       
   137 /** @fn  dlclose(void *handle)
       
   138 @param handle
       
   139 Refer to  dlopen() for the documentation
       
   140 
       
   141 
       
   142  
       
   143 
       
   144 @publishedAll
       
   145 @externallyDefinedApi
       
   146 */
       
   147 
       
   148 
       
   149 
       
   150 /** @def RTLD_LAZY
       
   151 
       
   152 Modes and flags for dlopen(). Bind function calls lazily. 
       
   153 
       
   154 @publishedAll
       
   155 @externallyDefinedApi
       
   156 */
       
   157 
       
   158 
       
   159 /** @def RTLD_NOW
       
   160 
       
   161 Modes and flags for dlopen(). Bind function calls immediately. 
       
   162 
       
   163 @publishedAll
       
   164 @externallyDefinedApi
       
   165 */
       
   166 
       
   167 
       
   168 /** @def RTLD_GLOBAL
       
   169 
       
   170 Modes and flags for dlopen(). Make symbols globally available.
       
   171 
       
   172 @publishedAll
       
   173 @externallyDefinedApi
       
   174 */
       
   175 
       
   176 
       
   177 /** @def RTLD_LOCAL	
       
   178 
       
   179 Modes and flags for dlopen(). Opposite of RTLD_GLOBAL, and the default. 
       
   180 
       
   181 @publishedAll
       
   182 @externallyDefinedApi
       
   183 */
       
   184 
       
   185 
       
   186 /** @def RTLD_NEXT	
       
   187 
       
   188 Special handle arguments for dlsym()/dlinfo(). Search subsequent objects.
       
   189 
       
   190 @publishedAll
       
   191 @released
       
   192 */
       
   193 
       
   194 
       
   195 /** @def RTLD_DEFAULT	
       
   196 
       
   197 Special handle arguments for dlsym()/dlinfo(). Use default search algorithm.
       
   198 
       
   199 @publishedAll
       
   200 @released
       
   201 */
       
   202 
       
   203 
       
   204 /** @def RTLD_SELF	
       
   205 
       
   206 Special handle arguments for dlsym()/dlinfo(). Search the caller itself.
       
   207 
       
   208 @publishedAll
       
   209 @released
       
   210 */
       
   211 
       
   212