我已经为 node.js 编写了一个原生插件,用 MSVC++ 编译它,没有 node-gyp,并在节点 REPL 和应用程序中成功使用它。我正在使用 x64 节点并编译 x64 插件。我正在尝试用 node-gyp 构建东西。我已经让 node-gyp 生成一个 Visual Studio 解决方案并编译它,但是出来的插件不起作用。我得到的唯一错误是:
Error: The specified procedure could not be found.
at Object.Module._extensions..node (module.js:480:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at repl:1:13
at REPLServer.self.eval (repl.js:111:21)
at rli.on.e (repl.js:260:20)
at REPLServer.self.eval (repl.js:118:5)
at Interface.<anonymous> (repl.js:250:12)
当我运行一个尝试加载插件的脚本时,我得到了这个:
module.js:480
process.dlopen(filename, module.exports);
^
Error: The specified procedure could not be found.
at Object.Module._extensions..node (module.js:480:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (c:\blah\testheaders.js:1:75)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
我了解到 dlopen 与在 Linux 上加载动态库有关,但找不到任何与节点相关的有用信息(特别是在 Windows 上)。这个插件需要一些第三方 dll,但它们在我的路径上,而且当我在没有 node-gyp 的情况下编译它时,插件工作正常。
我需要做什么才能弄清楚如何完成这项工作?