Skip to main content

load_native_module

Function load_native_module 

Source
pub fn load_native_module(
    interp: &mut Interp<'_>,
    runtime: *mut JsRuntime,
    module_name: &str,
) -> Result<Vec<(String, Value)>, String>
Expand description

Load a native module and hand back its exports.

interp is the interpreter that is importing it; the module’s JSContext * is an attached handle over exactly that interpreter, so a class it registers and an object it creates are the importing script’s.

§Errors

The reference’s three messages, verbatim: the library could not be opened, it has no js_init_module, or its init function failed. A script sees them as ReferenceErrors, because load_native’s error becomes one.