我编写了一个代码,用于从Windows的openldap C库调用某些函数。该程序已编译,但当我调用一个函数时,我得到下一个错误文本:
Error: The specified module could not be found.
\\?\C:\Users\cghitea\Desktop\nodeLdapClient\build\Release\binding.node
at Error (native)
at Object.Module._extensions..node (module.js:434:18)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\cghitea\Desktop\nodeLdapClient\test.js:4:17)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
我试图在Linux上运行相同的代码并且它有效。在我看来,node-gyp无法从C库中打开.lib文件。
这是我来自binding.gyp的代码
{
#'variables': {
#
# },
'targets': [
{
'target_name': 'binding',
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
'include_dirs' : [
"../nodeLdapClient/node_modules/nan",
"../nodeLdapClient/openldapsdk/inc",
"../nodeLdapClient/openldapsdk/bin",
"../nodeLdapClient/openldapsdk/lib",
],
'sources': [ 'binding.cc' ],
'dll_files': [
'../openldapsdk/bin/libeay32.dll',
'../openldapsdk/bin/ldapssl.dll',
'../openldapsdk/bin/liblber.dll',
'../openldapsdk/bin/libldap.dll',
'../openldapsdk/bin/libldap_r.dll',
'../openldapsdk/bin/liblunicode.dll',
'../openldapsdk/bin/liblutil.dll',
'../openldapsdk/bin/nldapextd.dll',
'../openldapsdk/bin/ssleay32.dll'
],
'libraries': [
'../openldapsdk/lib/ldap_ssl.lib',
'../openldapsdk/lib/libeay32.lib',
'../openldapsdk/lib/liblber.lib',
'../openldapsdk/lib/libldap.lib',
'../openldapsdk/lib/libldap_r.lib',
'../openldapsdk/lib/liblunicode.lib',
'../openldapsdk/lib/liblutil.lib',
'../openldapsdk/lib/nldapextd.lib',
'../openldapsdk/lib/ssleay32.lib'
],
'cflags!': ['-fno-exceptions'],
'cflags': ['-std=c++11'],
'cflags_cc': ['-fno-exceptions'],
}
]
}