nodejs ffi 調用dll


安裝依賴

npm install --global --production windows-build-tools(在管理員權限打開的命令行中執行)
npm install -g node-gyp //依賴python2.7,包含在windows-build-tools中

安裝 node-ffi

npm install ffi

 

安裝ref

npm install ref
'use strict';
const path = require('path');
let ffi = require('ffi');
let mydll = path.join(__dirname, '../dll/helloworld.dll');
let dll= ffi.Library(mydll, {
    'helloworld': ['int', ['int']]
});

console.log(dll.helloworld(1));//關閉 RLM 通信端口


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM