C++ nodejs:如何通过nodejs调用c++ DLL函数?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30364047/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
nodejs:How to call c++ DLL function through nodejs?
提问by Zexi Li
I have a windows c++ DLL. It provides some functions like add(1,2). But I don't have the source code for this DLL, is it possible call functions in this DLL through nodejs, I mean, through web side and http. If it possible, what should I do?
我有一个 Windows C++ DLL。它提供了一些函数,如 add(1,2)。但是我没有这个 DLL 的源代码,是否可以通过 nodejs 调用这个 DLL 中的函数,我的意思是,通过 web 端和 http。如果可以,我应该怎么做?
采纳答案by unkhan
Yes, there are some prominent solutions out there for using Nodejs with native/C++.
是的,有一些突出的解决方案可以将 Nodejs 与 native/C++ 结合使用。
Checkout this node-gyp tutorial: http://www.benfarrell.com/2013/01/03/c-and-node-js-an-unholy-combination-but-oh-so-right/
查看此 node-gyp 教程:http: //www.benfarrell.com/2013/01/03/c-and-node-js-an-unholy-combination-but-oh-so-right/
Or Node-ffi: https://github.com/node-ffi/node-ffi
或者 Node-ffi:https: //github.com/node-ffi/node-ffi