Abstraction to usual system calls such as library loading and time.
More...
◆ bj_begin()
- Parameters
-
p_error | An optional location to an error object. |
The initialization process will iteratively try to initialize a subsystem among the ones available and returns on the first that succeeded.
- Returns
- true if the system is properly initialized, BJ_FALSE otherswise.
- Examples
- audio_pcm.c, bitmap_blit.c, drawing_2d.c, load_bmp.c, shaders.c, sprite_animation.c, stopwatch.c, template.c, template_callbacks.c, time.c, and window.c.
◆ bj_end()
- Parameters
-
p_error | An optional location to an error object. |
- Examples
- audio_pcm.c, bitmap_blit.c, drawing_2d.c, load_bmp.c, shaders.c, sprite_animation.c, stopwatch.c, template.c, template_callbacks.c, time.c, and window.c.
◆ 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()