1

我有一个用 C++ 编写的节点扩展,需要链接到 OpenSSL。我还看到 Node 有一个使用 OpenSSL 实现的TLS 模块。我可以在 binding.gyp 文件中将我的扩展链接到 OpenSSL 的节点副本吗?

4

1 回答 1

1

It turns out that this exact scenario is covered in the node-gyp documentation. Basically, there are directories with OpenSSL headers that are included with the Node.js source distribution and that can be added to the node-gyp include path list. On Linux, actual linking is unnecessary because the symbols will be made available to the extension by the Node runtime when it is loaded.

On Windows, this does not work, and the extension needs to explicitly compile and link against an external copy of OpenSSL that is installed separately.

于 2015-10-26T17:16:02.170 回答