I successfully bound my nodejs to the 'TSCLIB.dll' using the ffi, but when I want to bind it to 'Eztwain3.dll', I always have "Error: Dynamic Linking Error: Win32 error 193".
C:\Users\dev\Desktop\nodeApp>node scan.js
C:\Users\dev\Desktop\nodeApp\node_modules\ffi\lib\dynamic_library.js:74
throw new Error('Dynamic Linking Error: ' + err)
^
Error: Dynamic Linking Error: Win32 error 193
at new DynamicLibrary (C:\Users\dev\Desktop\nodeApp\node_modules\ffi\lib\dynamic_library.js:74:11)
at Object.Library (C:\Users\dev\Desktop\nodeApp\node_modules\ffi\lib\library.js:45:12)
at Object.<anonymous> (C:\Users\dev\Desktop\nodeApp\scan.js:17:24)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
The execution shown above appear when I'm trying to run this script.
const ffi = require('ffi');
const ref = require('ref');
const platform = process.platform;
var lib = null;
if (platform === 'win32') {
lib = 'Eztwain3.dll';
} else {
throw new Error('unsupported plateform for lib')
}
var instance = ffi.Library(lib, {
});
https://i.sstatic.net/fwFm6.jpg
https://i.sstatic.net/Ozt4P.jpg
I tried to execute the same script with 'TSCLIB.dll' and it run without exeption.
So, how can I call the 'Eztwain3.dll' library with node ffi?
I resolve my problem by changing the nodejs from 64bit to 32bit because my dll is 32 bit