Electron通过ffi调用DLL
生活随笔
收集整理的這篇文章主要介紹了
Electron通过ffi调用DLL
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
第一步建立一個DLL
int WINAPI CAM_Open(char *pIn, char* pOut);第二步安裝ffi
npm install --save ffi
針對electron版本重新編譯
cd node_modules\ffi
node-gyp rebuild -target=1.6.11 -arch=x64 -dist-url=https://atom.io/download/atom-shellcd node_modules\ref
node-gyp rebuild -target=1.6.11 -arch=x64 -dist-url=https://atom.io/download/atom-shell第三步修改electron應用的index.html
<!DOCTYPE html> <html> <head><meta charset="UTF-8"><title>人臉識別測試程序</title> </head> <body> <button id="CAMOpen" name="CAMOpen">調(diào)用人臉識別DLL</button> </body> <script>//var addon = require("facerecognitiondll")//document.write(addon.CAMOpen())var ffi = require("ffi")var DLL = ffi.Library('FaceRecognition.dll', {'CAM_Open' : ['int', ['string', 'string']]});var result = DLL.CAM_Open("", "");document.write("CAM_Open return "+ result)</script> </html>
總結
以上是生活随笔為你收集整理的Electron通过ffi调用DLL的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Hyperledger Fabric 1
- 下一篇: Node.js Electron的扩展