sqlite3扩展功能:找不到指定的模块 [英] sqlite3 extension-functions: The specified module could not be found
问题描述
我正在尝试加载 extension-functions
sqlite3扩展名.可以在底部的此处找到C文件.
I'm trying to get the extension-functions
sqlite3 extension to load. The C file can be found here at the bottom.
我正在运行win10并使用VS2015.我已经将32位和64位版本均编译为.dll(没有错误),并尝试使用带有相同错误的sqlite3 shell加载它们.(分别使用sqlite3.dll文件的32位和64位版本).下面,我尝试使用32位sqlite加载扩展.
I'm running win10 and using VS2015. I have compiled (with no errors) both 32 and 64 bit versions to .dll and tried loading them using the sqlite3 shell with the same error. (Using both 32 and 64 bit versions of the sqlite3.dll file respectively). Below I'm trying to load the extension using 32bit sqlite.
sqlite> select load_extension('C:\sqlite\ext32.dll');
Error: The specified procedure could not be found.
sqlite> select load_extension('C:\sqlite\ext64.dll');
Error: The specified module could not be found.
我使用此命令来编译32位 cl extension-functions.c -link -dll -out:ext32.dll
.然后,我为64位版本运行了 vcvarsall x64
和 cl extension-functions.c -link -dll -out:ext64.dll
.
I used this command for compiling 32bit cl extension-functions.c -link -dll -out:ext32.dll
. Then I ran vcvarsall x64
and ran cl extension-functions.c -link -dll -out:ext64.dll
for the 64bit version.
推荐答案
extension-functions.c
不会导出任何函数(也称为过程"),因此,输出DLL也是如此真没用.
extension-functions.c
doesn't export any function (aka 'procedure'), so, as is, the output DLL is pretty useless.
SQLite外壳需要一个名为 sqlite3_extension_init
的函数,如编程可加载扩展 SQLite文档章节.
The SQLite shell expects a function named sqlite3_extension_init
as stated in the Programming Loadable Extensions SQLite documentation chapter.
因此,您只需要像这样修改 extension-functions.c
(大约1837行).
So, you just have to modify extension-functions.c
like this (around line 1837).
之前:
#ifdef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
int sqlite3_extension_init(
sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi){
SQLITE_EXTENSION_INIT2(pApi);
RegisterExtensionFunctions(db);
return 0;
}
#endif /* COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE */
之后:
#ifdef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_extension_init(
sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi){
SQLITE_EXTENSION_INIT2(pApi);
RegisterExtensionFunctions(db);
return 0;
}
#endif /* COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE */
这篇关于sqlite3扩展功能:找不到指定的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!