I am writing code to load c++ dll from electron.I am using NaN and bindings (node-gyp) to achieve this. I run the following command to build my node module:
electron-rebuild -f -w yourmodule --arch=ia32
This command creates a Release folder inside build folder where the built .node module is saved. To run my application I need to copy all the dependent dlls to the Release folder. The problem is every time I rebuild my module, all the copied dlls are deleted from Release folder. Is there a way by which I can set custom path for the required dlls?
You can add a copies
section to your binding.gyp file so that your dlls are copied to the ".node" file location every build.
{
"targets": [
{
"conditions":[
["OS=='win'", {
"copies":
[
{
'destination': '<(module_root_dir)/build/Release',
'files': [
'<(module_root_dir)/yourdllfile1.dll',
'<(module_root_dir)/yourdllfile2.dll',
]
}
]
}]
]
}
]
}