安装依赖
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 通信端口