[英]'IM003', '[IM003] system error 126: The specified module could not be found (When using ICU library)
Building C/C++ code in windows
for the first time in my career,在我的职业生涯中第一次在windows
中构建 C/C++ 代码,
I need to make a change in a 'legacy' ( odbc ) code to use a new ( ICU , static) library.我需要更改“遗留”( odbc )代码以使用新的( ICU ,静态)库。
I made code changes via Vidual studio (2015) and added include and lib dependncies via project properties.我通过 Vidual studio (2015) 更改了代码,并通过项目属性添加了 include 和 lib 依赖项。
Build (dll) and packaging (msi) is done via a script in command line.构建 (dll) 和打包 (msi) 是通过命令行中的脚本完成的。
If I build the original code base with no changes, application works as expected.如果我构建原始代码库而不做任何更改,应用程序将按预期工作。
As soos as I add minimal ICU related stuff, I get an error:当我添加最少的 ICU 相关内容时,我收到一个错误:
#include <unicode/ucnv.h>
#include <unicode/unistr.h>
#include <unicode/urename.h>
#include <unicode/stringpiece.h>
// Unicode version of SQLExecDirect.
//
SQLRETURN SQL_API SQLExecDirectW(SQLHSTMT phstmt,
SQLWCHAR* pwCmd,
SQLINTEGER cchLen)
{
icu::UnicodeString ustr(pwCmd, cchLen*sizeof(SQLWCHAR));
//...
}
When I test the build using:当我使用以下方法测试构建时:
import pyodbc
query = 'anything'
statement = f"SELECT '{query}'"
print(statement)
cnxn = pyodbc.connect('Driver={Amazon Redshift ODBC Driver (x64)};Server=xxx;Port=5439;Database=dev;UID=xxx;PWD=xxx')
cursor = cnxn.cursor()
cursor.execute(statement)
val = cursor.fetchall()[0][0]
I get:我得到:
InterfaceError Traceback (most recent call last)
xxx\Documents\test.py in line 9
10 query = 'anything'
11 statement = f"SELECT '{query}'"
----> 12 cnxn = pyodbc.connect('Driver={Amazon Redshift ODBC Driver (x64)};Server=xxx;Port=5439;Database=dev;UID=xxx;PWD=xxx')
13 cursor = cnxn.cursor()
InterfaceError: ('IM003', '[IM003] Specified driver could not be loaded due to system error 126:
The specified module could not be found.
(Amazon Redshift ODBC Driver (x64), C:\\Program Files\\Amazon Redshift ODBC Driver x64\\Drivers\\rsodbc.dll).
(160) (SQLDriverConnect)')
dumpbin
against rsodbc.dll and it doesn't seem to contain SQLDriverConnect the way it apeared before linking ICU lib(not 100% sure though)我对 rsodbc.dll 使用了dumpbin
,它似乎不包含 SQLDriverConnect 在链接 ICU lib 之前出现的方式(虽然不是 100% 确定)Any hints plz?有什么提示吗?
Checking my odbc.dll using Dependencies
app, I realized that, I also needed to include icuuc70.dll & icudt70.dll in the same folder as my odbc.dll.使用Dependencies
应用检查我的 odbc.dll,我意识到,我还需要将 icuuc70.dll 和 icudt70.dll 包含在与我的 odbc.dll.8 相同的文件夹中(i had just linked against icu*.lib files) (我刚刚链接到 icu*.lib 文件)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.