I try to load a local .dll according the examples on stackoverflow and node-ffi documentation. But I get the error ENOENT: no such file or directory, open '../test/user32.dll.so'. The file is there (no exception). The extension '.so' is added automatically. Any idea what I'm doing wrong? Is this code plattform dependent? I'm on Debian.
const path = require('path');
const fs = require('fs');
const ffi = require('ffi');
function setCursor() {
const dllFile = path.join('../test', 'user32.dll');
if (!fs.existsSync(dllFile)) {
throw (new Error('dll does not exist'));
}
const user32 = ffi.Library(dllFile, {
"SetCursorPos": [
"bool", ["int32", "int32"]
]
});
console.log(user32.SetCursorPos(0, 0));
}
setCursor();
I ended up using https://www.npmjs.com/package/koffi instead off node-ffi.