wilton.js  v202103141
 All Namespaces Functions
Functions
dyload Namespace Reference

wilton/dyload
Load native shared library. More...

Functions

Undefined dyload (Object options, Function|Undefined callback)
 Load native shared library.

Detailed Description

This module allows to load native shared libraries that provide additional wiltoncall functions.

Library loading process is OS-specific. Function wilton_module_init is called on the native library immediately after load. This function must be available as a "public symbol" and should use wiltoncall_register (C API) or wilton::support::register_wiltoncall (C++ API) to register native functions to be used from JavaScript through wiltoncall module.

If library with this name is already loaded in current process, this function will do nothing.

Usage example:

// load native lib from the current executable directory
// `libwilton_db.so` or `wilton_db.dll` will be loaded
// depending on platform
name: "wilton_db"
});

Function Documentation

Undefined dyload::dyload ( Object  options,
Function|Undefined  callback 
)

Loads native shared library at the specified path and calls wilton_module_init function on the loaded lib.

Parameters
optionsObject configuration object, see possible options below
callbackFunction|Undefined callback to receive result or error
Returns
Undefined

Options

  • name String "logical" library name, will be converted to platform-specific file name before load
  • directory String|Undefined directory to load library from, default value: current executable directory