pub struct Module { /* private fields */ }Expand description
A handle to a dynamically loaded OSAL module (shared library).
This is a wrapper around an osal_id_t that will automatically call
OS_ModuleUnload when it goes out of scope, preventing resource leaks.
Implementations§
Source§impl Module
impl Module
Sourcepub fn load(name: &str, filename: &str, flags: ModuleFlags) -> Result<Self>
pub fn load(name: &str, filename: &str, flags: ModuleFlags) -> Result<Self>
Loads a shared library object file into the running system.
GLOBAL_SYMBOLS is the default; use LOCAL_SYMBOLS for
safer unloading, then use Module::symbol to look up
local symbols.
§Arguments
name: A unique logical name to identify the module.filename: The path to the object file to load (e.g., “/cf/my_lib.so”).flags: Options for how symbols are loaded.
Sourcepub fn symbol(&self, name: &str) -> Result<*mut c_void>
pub fn symbol(&self, name: &str) -> Result<*mut c_void>
Looks up the address of a symbol within this module.
This is useful for finding function pointers in modules loaded with
ModuleFlags::LOCAL_SYMBOLS.
§Safety
Using the returned pointer is inherently unsafe. The caller must ensure
it is cast to the correct function pointer type and that the function
signature is correct. The symbol’s lifetime is tied to the Module instance.
Sourcepub fn info(&self) -> Result<ModuleProp>
pub fn info(&self) -> Result<ModuleProp>
Retrieves information about this module.