SQLite Forum

SQLite3 extensions: extension-functions.c in Windows doesn't load

SQLite3 extensions: extension-functions.c in Windows doesn't load

(1) By anonymous on 2021-04-12 10:09:28 [source]

I have sqlite3 3.33.0 in Windows 10 and I would like to include some extensions for it.

I managed to include the extension uuid.c: I compiled in Windows and it loaded and functioned properly in sqlite3.

However, I didn't manage to successfully load the extension extension-functions.c in the system.


cl extension-functions.c -link -dll -out:libsqlitefunctions.dll

(compiles successfully)

Loading in sqlite3:

.load ./libsqlitefunctions.dll
Error: Impossível localizar o procedimento especificado.
(the error says: Impossible localize specified procedure) (I also tried to write the file name in other formats...)

With the same extension files, I managed to install them in a linux computer successfully.

Do anyone knows what is the problem?

Which compilation statement should I run? Is this ok?

(2) By Gunter Hick (gunter_hick) on 2021-04-12 11:13:58 in reply to 1 [link] [source]

Are you sure that the dll file is in the working directory of the sqlite shell? 

Are you sure that there is an entrypoint with the name sqlite is using to initialize the extension?

Are you sure you are running the same sqlite.dll in both cases? Or rather a custom sqlite.dll with "included" uuid.c in one case and whatever windows regards as sqlite.dll in the other?

If you need to have a specially built sqlite library, you should statically link it to your application.

(3) By anonymous on 2021-04-12 12:36:57 in reply to 2 [link] [source]

I have the DLL in the proper directory. I think the error states that the sqlite doesn't find the entry point.

I run dumpbin /exports libsqlitefunctions.dll and found that there is not a single exported function. However, in the uuid.c, such a point exists, and the initialization function was decorated (for Windows) with __declspec(dllexport). The same doesn't happen in extension-functions.c: such decoration doesn't exist in any function.

Do you have a source file for extension-functions compatible with Windows (ie properly decorated), or should I edit the source file and decorate the initialization function?

(4) By anonymous on 2021-04-12 14:21:34 in reply to 3 [link] [source]

I decorated the initialization function with __declspec(dllexport):

#ifdef _WIN32
int sqlite3_extension_init(

and the generated dll functioned properly.