addgateway
Adds dynamically builtin at runtime.
📝Syntax
addgateway(dyn_lib_path)
addgateway(dyn_lib_path, mode)
addgateway(dyn_lib_path, module_name, mode)
📥Input Arguments
Parameter Description
dyn_lib_path a string: path of a dynamic library prepared for Nelson.
mode a string: auto uses the gateway cache and lazy-loading when possible, loaded forces immediate loading.
📄Description

addgateway(dyn_lib_path) adds dynamically builtin at runtime.

The dynamic library must provide GetGatewayDescriptor and AddGateway.

By default, auto mode registers lazy builtins from the cache when possible. Use loaded to force the dynamic library to be loaded immediately.

Gateway descriptors are stored in one cache file, prefdir()/gateway_cache.json. Nelson rebuilds the cache entry automatically when the dynamic library changes.

Set NELSON_GATEWAY_TRACE=1 to print gateway cache and loading decisions. Set NELSON_GATEWAY_FORCE_LOADED=1 to force immediate loading for all gateways.

If gateway was already loaded, no error or warning will be raised.

💡Examples
Add gateway for string module:
addgateway(modulepath('time', 'builtin'), 'loaded')
🔗See Also
removegatewaygatewayinfo
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub