Saturday 27 May 2017

How to call DLL which depends on WIN32 API from node.js running on Linux?

I have a web application running on windows 7 x64 and I'm trying to port it to linux ubuntu 16.04 x64. The setup comprises node.js and uses edge.js library to interface with .NET DLLs of my own and a third party DLL.

The .NET DLLs don't have dependencies outside .NET Framework. I don't have access to the third party's DLL code, but running it through dumpbin.exe I know it depends on WIN32 DLLs like kernel32.dll, gdi32.dll, advapi32.dll, and others alike. In windows the third party DLL required registration through regsvr32.exe and it had to be copied to c:/windows/system32 folder. It also required an interop.DLL assembly generated with tlbimp.exe, wich is referenced from a wrapper DLL.

node.js -> edge.js -> wrapper1 (.NET DLL) -> interop.DLL -> third party DLL -> WIN32 APIs
                  |
                  `-> wrapper2 (.NET DLL) ----------------> my own .NET DLL

So far I've accomplished running the node.js server on linux and interfacing through edge.js with the .NET DLLs of my own (had to install mono).

But I was not able to interface with the third party DLL. I used wine to register the thrid party DLL (wine64 regsvr32 thirdParty.dll) and copied it to ~/.wine/drive_c/windows/system32. But I don't know how to call it from the node.js/edge.js/wrapper1 running on linux. In windows, as the third party DLL is registered, the interop.DLL just finds it, but this seems improbable with linux/wine.

How should I call the third party DLL depending con WIN32 API from node.js running on linux?



via Ale

No comments:

Post a Comment