node-ffi: How to fix Dynamic Linking Error?

Hi, I read here about similar issues but it couldn’t be helpful for my case. my problem:

I wrote RunCmd.dll C++ on windows 7 which run synchronic command line(process), the dll was tested successfully using C#, but when using FFI module I got error:

C:\Program Files\nodejs\node_modules\ffi\lib\dynamic_library.js:74
    throw new Error('Dynamic Linking Error: ' + err)
          ^
Error: Dynamic Linking Error: "RunCmd":

my code: (java script)

var nativeC = new ffi.Library("RunCmd", {
  "run_sync_process": ["void", ["LPTSTR"]]
});

console.log('running notepad');
var run = nativeC.run_sync_process;

run('notepad.exe');

I also try:

var libA = ffi.DynamicLibrary('RunCmd');

and got the same error Any suggestion?

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 33 (9 by maintainers)

Most upvoted comments

Try passing in the full path to RunCmd. i.e. __dirname + '\\RunCmd.dll'.