I want to load a dll file from node js. Here is the header file:
#pragma once
#ifdef __cplusplus
#define EXAMPLE __declspec(dllexport)
extern "C" {
EXAMPLE int Add(int, int);
}
#endif
In compile as, i choose "compile as C code"
In active solution platform, I choose x64
And then, I use ffi module to load it:
var ffi = require('ffi');
var Lib = ffi.Library('test', {'Add' : ['int',['int','int']]});
But I got an Error:
C:\Users\TheHai\node_modules\ffi\lib\dynamic_library.js:112
throw new Error('Dynamic Symbol Retrieval Error: ' + this.error())
^
Error: Dynamic Symbol Retrieval Error: Win32 error 127
at DynamicLibrary.get (C:\Users\TheHai\node_modules\ffi\lib\dynamic_library.js:112:11)
at C:\Users\TheHai\node_modules\ffi\lib\library.js:50:19
at Array.forEach (native)
at Object.Library (C:\Users\TheHai\node_modules\ffi\lib\library.js:47:28)
at Object.<anonymous> (C:\Users\TheHai\Downloads\Compressed\nodejs-websocket-master\samples\chat\server.js:8:15)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)