spBase
Loading...
Searching...
No Matches
Dynamic Library Loading

Functions

void * spOpenLibrary (const char *filename)
 
void * spGetSymbolAddress (void *handle, const char *symbol)
 
void spCloseLibrary (void *handle)
 

Detailed Description

Function Documentation

◆ spOpenLibrary()

void * spOpenLibrary ( const char * filename)
extern

Opens the dynamic library associated with filename. The behavior of multiple function calls for the same library depends on an environment. On some environments the function calls map the library to multiple address spaces, on others the calls map the library to one address space. Therefore, you have to write code independent from this behavior. Moreover, the behavior without directory path depends on an environment.

Parameters
[in]filenameThe null-terminated name of the file associated with the dynamic library.
Returns
The handle of the library.
See also
spCloseLibrary()
Examples
openlib.c.

◆ spGetSymbolAddress()

void * spGetSymbolAddress ( void * handle,
const char * symbol )
extern

Gets the address of the function included in the dynamic library.

Parameters
[in]handleThe handle of the dynamic library.
[in]symbolThe null-terminated name of the function. For example, symbol is "func" if the function is func.
Returns
The address of the function. This address can be used as the pointer to the function.
See also
spOpenLibrary()
Examples
openlib.c.

◆ spCloseLibrary()

void spCloseLibrary ( void * handle)
extern

Closes the dynamic library.

Parameters
[in]handleThe handle of the dynamic library.
See also
spOpenLibrary()
Examples
openlib.c.