Abstraction to usual system calls such as library loading and time.
More...
|
bj_bool | bj_begin (bj_error **p_error) |
| Initializes the system.
|
|
void | bj_end (bj_error **p_error) |
| De-initializes the system.
|
|
void * | bj_load_library (const char *p_path) |
| Load the provided dynamic library and returns and opaque handle to it.
|
|
void | bj_unload_library (void *p_handle) |
| Unload a library loaded with bj_load_library from memory.
|
|
void * | bj_get_symbol (void *p_handle, const char *p_name) |
| Get the address of a function exported by p_handle given its name.
|
|
◆ bj_begin()
◆ bj_end()
◆ bj_get_symbol()
void * bj_get_symbol |
( |
void * | p_handle, |
|
|
const char * | p_name ) |
This function is an abstraction over the platform specific function like dlsym
and GetProcAddress
.
- Parameters
-
p_handle | A library handle provided by bj_load_library. |
p_name | C-String name of the function to retrieve |
- Returns
- 0 or the address of the retrieved function.
- Behaviour
- On Unix platforms,
p_handle
and p_name
are passed to dlsym()
.
- On Windows,
p_handle
and p_name
are passed to GetProcAddress()
.
- Memory Management
The caller is responsible for release the loaded function using bj_unload_library with p_handle
.
- See also
- bj_load_library, bj_unload_library
-
dlsym(), GetProcAddress()
◆ bj_load_library()
void * bj_load_library |
( |
const char * | p_path | ) |
|
This function is an abstraction over the platform specific function like dlopen
and LoadLibrary
. The provided pointer can be used with bj_get_symbol to get a function from the loaded library.
- Parameters
-
p_path | A C-string path to the library to load. |
- Returns
- 0 or a handle to the loaded library.
- Behaviour
- On Unix platforms,
p_path
is passed to dlopen()
with RTLD_LAZY
and RTLD_LOCAL
flags.
- On Windows,
p_path
is passed to LoadLibraryA()
.
- Memory Management
The caller is responsible for release the loaded library using bj_unload_library.
- See also
- bj_get_symbol, bj_unload_library
-
dlopen(), LoadLibraryA()
◆ bj_unload_library()
void bj_unload_library |
( |
void * | p_handle | ) |
|
This function is an abstraction over the platform specific function like dlclose
and FreeLibrary
.
- Parameters
-
p_handle | The library to unload. |
- Behaviour
- On Unix platforms,
p_handle
is passed to dlclose()
.
- On Windows,
p_path
is passed to FreeLibrary()
.
- Memory Management
The caller is responsible for release the loaded library using bj_unload_library.
- See also
- bj_get_symbol, bj_unload_library
-
dlclose(), FreeLibrary()