問題描述
我遇到了如何將示例 .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
這篇關于如何在 Electron App 中調用本地 .dll 文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!