new DynamicLibrary(path)


  • path <string> | <null> 动态库的路径,或使用 null 从当前进程镜像解析符号。

加载动态库而不急于解析任何函数。

🌐 Loads the dynamic library without resolving any functions eagerly.

在 Windows 上不支持传递 null。

🌐 On Windows passing null is not supported.

安装在已挂载的 虚拟文件系统 内的 path 加载方式与 ffi.dlopen() 相同。

🌐 A path inside a mounted virtual file system loads the same way as with ffi.dlopen().

const { DynamicLibrary, suffix } = require('node:ffi');

const lib = new DynamicLibrary(`./mylib.${suffix}`);