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 通信端口