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