如何在 Electron App 中调用本地 .dll 文件
我遇到了如何将示例 .dll 文件调用到我的 Electron 应用程序中的问题.我的文件夹中有示例 .dll 文件,问题是如何访问我的 sample.dll 文件以及如何调用我的 sample.dll 函数并获得结果.任何教程或步骤请遵循示例代码开始
i have an issue how to call sample .dll files into my Electron App. I have sample .dll files in my folder, the thing is how to access my sample.dll file and how to call my sample.dll function and gets results. Any tutorials or steps to follow please sample code to start
推荐答案
在 Electron 中调用 .dll
与在普通 NodeJS 中调用一个没有什么不同,这意味着你有两个选择,node-ffi 或 本机节点插件,它与您的 .dll
链接并公开 JavaScript API.如果你决定创建一个原生 Node 插件,你需要 构建它目标电子.
Calling into a .dll
in Electron is no different to calling into one in plain NodeJS, which means you have two options, node-ffi or a native Node addon that links with your .dll
and exposes a JavaScript API. If you decide to create a native Node addon you will need to build it to target Electron.
以下是一些涵盖这些主题的链接:
Here are some links that cover these topics:
- node-ffi vs. 访问节点扩展现有的 C++ 功能
- 从Node.js调用C++库(Node插件/node-ffi)
- https://github.com/node-ffi/node-ffi/wiki/Node-FFI-教程
- https://blog.scottfrees.com/calling-native-c-dlls-from-a-node-js-web-app
- http://blog.scottfrees.com/building-an-asynchronous-c-addon-for-node-js-using-nan
相关文章