mimecorg / launchui

Launcher for GUI Node.js applications using libui-node.
MIT License
107 stars 10 forks source link

native modules support? #8

Open yrik opened 5 years ago

yrik commented 5 years ago

Thanks for the nice project.

I have downloaded the code of the package and tried to include a native module (keytar) as a dependency.

I have added node_modules with freshly built keytar to the app folder. However when I call require('./node_modules/keytar/build/Release/keytar.node') it says A dynamic link library initialization failed. I have locally exactly the same node version as used in the launchui. When I try to require it directly from the node it works fine.

Is it something related to the way node.h is used?

mimecorg commented 5 years ago

I think that the problem is that launchui builds node as a shared library, and standard native modules are linked against a static node executable. It's a similar problem to using native modules with Electron.

If you compile launchui from sources, then you can try to recompile the native module using the version of node from the deps/node subdirectory.

yrik commented 5 years ago

Thank you for the answer! It gave me some hints already.

I've looked deeper and here is the progress so far https://stackoverflow.com/questions/55328514/how-to-build-native-nodejs-modules-for-launchui

Currently struggling with how to rebuild native modules in a way that they are dependent on node.dll and not node.exe.

Could you advise something?

yrik commented 5 years ago

If you compile launchui from sources, then you can try to recompile the native module using the version of node from the deps/node subdirectory.

Thanks, it's actually helped.