Synesis Software

dlopen() API
[Synesis Software UNIX Emulation for Win32]


Detailed Description

This API provides facilities for manipulating dynamically loaded executable modules.


Defines

#define RTLD_LAZY   (UNIXEM_RTLD_LAZY)
#define RTLD_NOW   (UNIXEM_RTLD_NOW)
#define UNIXEM_RTLD_LAZY   (0x00001)
#define UNIXEM_RTLD_NOW   (0x00002)

Functions

void * dlopen (char const *moduleName, int mode)
 Loads the given module,.
void dlclose (void *hModule)
 Closes the given module.
void * dlsym (void *hModule, char const *symbolName)
 Looks up a symbol.
char const * dlerror (void)
 Returns a descriptive string for the last error.
void * unixem_dlopen (char const *moduleName, int mode)
 Loads the given module,.
int unixem_dlclose (void *hModule)
 Closes the given module.
void * unixem_dlsym (void *hModule, char const *symbolName)
 Looks up a symbol.
char const * unixem_dlerror (void)
 Returns a descriptive string for the last error.


Define Documentation

#define RTLD_LAZY   (UNIXEM_RTLD_LAZY)

Lazy function call binding.

#define RTLD_NOW   (UNIXEM_RTLD_NOW)

Immediate function call binding.

#define UNIXEM_RTLD_LAZY   (0x00001)

Lazy function call binding.

Referenced by unixem_dlopen().

#define UNIXEM_RTLD_NOW   (0x00002)

Immediate function call binding.


Function Documentation

void dlclose ( void *  hModule  ) 

Closes the given module.

Parameters:
hModule The handle of the executable module to close
Return values:
0 success
!0 failure. dlerror() will return an error string
Note:
This is a macro, which resolves to unixem_dlclose()

char const* dlerror ( void   ) 

Returns a descriptive string for the last error.

Returns:
A pointer to a string describing the last error, or NULL.
Return values:
NULL No error occured, or dlerror() already called
Note:
Each call to this function resets it, so that a second call will always return NULL

This is a macro, which resolves to unixem_dlerror()

void* dlopen ( char const *  moduleName,
int  mode 
)

Loads the given module,.

Parameters:
moduleName The name of the module. The name is passed through to Win32's LoadLibrary(), so the value of this parameter is interpreted according to Win32's loading rules.
mode The loading mode. This is ignored on Win32 platforms, and the function always behaves as if RTLD_NOW was specified
Note:
This is a macro, which resolves to unixem_dlopen()

void* dlsym ( void *  hModule,
char const *  symbolName 
)

Looks up a symbol.

Parameters:
hModule The handle of the executable module in which to search for the symbol
symbolName The name of the symbol
Returns:
The pointer to the symbol, or NULL if no matching symbol was found
Return values:
NULL The symbol was not found
Note:
This is a macro, which resolves to unixem_dlsym()

int unixem_dlclose ( void *  hModule  ) 

Closes the given module.

Parameters:
hModule The handle of the executable module to close
Return values:
0 success
!0 failure. dlerror() will return an error string

char const* unixem_dlerror ( void   ) 

Returns a descriptive string for the last error.

Returns:
A pointer to a string describing the last error, or NULL.
Return values:
NULL No error occured, or dlerror() already called
Note:
Each call to this function resets it, so that a second call will always return NULL

void* unixem_dlopen ( char const *  moduleName,
int  mode 
)

Loads the given module,.

Parameters:
moduleName The name of the module. The name is passed through to Win32's LoadLibrary(), so the value of this parameter is interpreted according to Win32's loading rules.
mode The loading mode. This is ignored on Win32 platforms, and the function always behaves as if RTLD_NOW was specified
Note:

References UNIXEM_RTLD_LAZY.

void* unixem_dlsym ( void *  hModule,
char const *  symbolName 
)

Looks up a symbol.

Parameters:
hModule The handle of the executable module in which to search for the symbol
symbolName The name of the symbol
Returns:
The pointer to the symbol, or NULL if no matching symbol was found
Return values:
NULL The symbol was not found


UNIX Emulation for Win32 Libraries documentation © Synesis Software Pty Ltd, 2002-2010