Search code examples
sqlitevisual-c++

How to build sqlite3.dll with the command line in Windows with Visual C++?


The source sqlite3.c has very few if at all, _declspec(dllexport) functions thus building it to a DLL in Windows produces an empty DLL!

My cmd line is:

cl sqlite3.c -link -dll -out:sqlite3.dll

where is the export file? How do I export the functions to the DLL?

Regards, Juan


Solution

  • Just define the SQLITE_API preprocessing symbol with the value __declspec(dllexport), by adding the appropriate option to the command line (before the other options):

    cl sqlite3.c -DSQLITE_API=__declspec(dllexport) -link -dll -out:sqlite3.dll