I am trying to link my C++ library as a native add-on to my electron app.
I am able to run node-gyp rebuild and generate a successful .node file.
But, when I try to call into it from main.js, I get an error which says: “A dynamic link library
(DLL) initialization routine failed”.
My binding.gyp file looks like this:
{
'targets': [
{
# Usual target name/sources, etc.
'target_name': 'myclass',
'sources': [ 'myclass.cc', 'addon.cc' ],
'libraries': ["../libs/api.lib",
"../libs/core.lib",
"../libs/camera.lib",
"../libs/algo.lib",
"../libs/ComCtl32.lib",
"../../deps/windows/opencv/lib/x64/*.lib",
"../../deps/windows/tbb/lib/x64/*.lib"],
'include_dirs': ["<!(node -e \"require('nan')\")"],
'configurations': {
'Debug': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': '3' # /MDd
},
},
},
'Release': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': '2' # /MD
},
},
},
},
},],
}
What could be wrong? Please let me know if any more information is needed.