I'm creating a DLL (abc.dll) with the help of makefile using cygwin64 to generate the DLL, I'm also generating a CLI exe (xyz.exe) with the same method and I'm trying to access a abc.dll in the xyz.exe and I faced no issues while accessing the abc.dll in the xyz.exe.
But when I try to access the same DLL in the node.js code I'm facing an issue where I can et no output from the DLL and looks like a stuck when I hit command like "node dummy.js", however I can access other dlls created using cmakelist but cannot access a DLL created using cygwin64 using makefile. The difference I can see is cmakefile uses msvc compiler and makefile(using cygwin64) uses gcc compiler to compile a DLL. How can I access a abc.dll using my node.js code?
Lising method from the abc.dll should print "Calling listing method" and should return a drive name.
dummy.js
const ffi = require("ffi-napi");
const path = "C:\\Users\\Vt\\Desktop\\Frontend repo\\frontend\\src\\components\\dll\\abc.dll";
const myDLL = ffi.Library(path, { 'listing': ['string', []] });
function callDLLFunction() {
return myDLL.listing();
}
module.exports = {myDLL}
console.log(callDLLFunction());
I have tried running "node dummy.js" command in the administrative command prompt as well but no luck there as well. (Running in administrative mode because DLL needs admin access to fetch out the list of drives).