SQLite Forum

Compiling Windows DLL from Amalgamation
Login

Compiling Windows DLL from Amalgamation

(1.1) By Ppro6 (Chanda) on 2021-01-18 11:36:08 edited from 1.0 [link] [source]

Hello everyone, I have been trying to compile a windows DLL using the amalgamation files to activate other functions. I have been using MinGW to make a 32-bit DLL. I followed the suggested compiler commands in the sqlite documentation

gcc -g -Os sqlite3.c -shared -o sqlite3.dll

and I compile to completion but when I try to use the DLL I get the error code OS 16r7E. Clearly I am missing some inclusions in the command. Please help.

(2.1) By Keith Medcalf (kmedcalf) on 2021-01-18 14:38:23 edited from 2.0 in reply to 1.1 [source]

Add a -DSQLITE_API=__declspec(dllexport) (or add a .def file as input to the linker)

The Windows default is to not export symbols unless you tell the linker to do so.
The Linux default is to export all symbols unless you tell the linker not to.

The command line you are using assumes Linux behaviour, not Windows behaviour.

Note also that -shared is a Linuxism. If you are using a recent version of MinGW you probably mean -mdll even though many versions of gcc will accept -shared as an alias for -mdll this is not always the case.

(3) By Ppro6 (Chanda) on 2021-01-18 16:13:15 in reply to 2.1 [link] [source]

Thank you, that did the trick.