Module emf_core_base_rs_ffi::module [−][src]
Module api.
Example
use emf_core_base_rs_ffi::sys::api::SysBinding; use emf_core_base_rs_ffi::version::api::VersionBinding; use emf_core_base_rs_ffi::module::api::ModuleBinding; use emf_core_base_rs_ffi::library::OSPathChar; use emf_core_base_rs_ffi::collections::{NonNullConst, ConstSpan}; use emf_core_base_rs_ffi::module::{MODULE_LOADER_DEFAULT_HANDLE, InterfaceDescriptor, InterfaceName}; unsafe { // `base_interface` has the type `&mut dyn CBaseBinding`. SysBinding::lock(base_interface); // Path of the module. Platform dependent initialisation. let mod_path: OSPathChar = unsafe { std::mem::MaybeUninit::uninit().assume_init() }; let handle = match ModuleBinding::add_module( base_interface, MODULE_LOADER_DEFAULT_HANDLE, NonNullConst::from(&mod_path) ).to_result() { Ok(handle) => handle, Err(_) => { SysBinding::panic( base_interface, Some(NonNullConst::from(b"Unable to add the module.\0")) ); } }; if ModuleBinding::load(base_interface, handle).is_err() { SysBinding::panic( base_interface, Some(NonNullConst::from(b"Unable to load the module.\0")) ); } if ModuleBinding::initialize(base_interface, handle).is_err() { SysBinding::panic( base_interface, Some(NonNullConst::from(b"Unable to initialize the module.\0")) ); } let interface_desc = InterfaceDescriptor { name: InterfaceName::from("jobs_interface"), version: VersionBinding::new_short(base_interface, 1, 0, 0), extensions: ConstSpan::new() }; if ModuleBinding::export_interface( base_interface, handle, NonNullConst::from(&interface_desc) ).is_err() { SysBinding::panic( base_interface, Some(NonNullConst::from(b"Unable to export the interface.\0")) ); } SysBinding::unlock(base_interface); }
Modules
api | Module api. |
module_loader | Interface of a module loader. |
native_module | Interface of a native module. |
Structs
Interface | Interface from a module. |
InterfaceDescriptor | Information regarding an interface. |
InternalHandle | Internal handle of a module. |
LoaderHandle | Handle of a module loader. |
ModuleHandle | Handle of a module. |
ModuleInfo | Information regarding a module. |
Enums
Error | Module api errors. |
ModuleStatus | Status of a module. |
PredefinedHandles | Predefined loader handles. |
Constants
INTERFACE_EXTENSION_NAME_MAX_LENGTH | Maximum length of an extension name. |
INTERFACE_INFO_NAME_MAX_LENGTH | Maximum length of an interface name. |
MODULE_INFO_NAME_MAX_LENGTH | Maximum length of a module name. |
MODULE_INFO_VERSION_MAX_LENGTH | Maximum length of a module version. |
MODULE_LOADER_DEFAULT_HANDLE | Default loader handle. |
MODULE_LOADER_TYPE_MAX_LENGTH | Maximum length of a module type. |
NATIVE_MODULE_INTERFACE_SYMBOL_NAME | Native module entry symbol. |
NATIVE_MODULE_TYPE_NAME | Type of a native module. |
Type Definitions
InterfaceExtension | Extension of an interface. |
InterfaceName | Name of an interface. |
ModuleName | Name of a module. |
ModuleType | Type of a module. |
ModuleVersion | Version a module. |