C language > Tips & tricks

Sqlite 3 with PellesC

(1/1)

kobold:
I will explain here how to get Sqlite 3 running with your PellesC application. I had some trouble because there was no lib file delivered with the packages. But no problem, we can make one!


Download http://www.sqlite.org/sqlitedll-3_3_4.zip and unpack the stuff into a new directory.

We have to modify the def file now a little bit.
Open the sqlite def file with wordpad (not the windows editor!)
It will look like:

--- Code: ---
EXPORTS
sqlite3_aggregate_context
sqlite3_aggregate_count
...

--- End code ---


Add "LIBRARY sqlite3" (it is important that the name is the same as the name of your sqlite dll!)

After that it looks like:


--- Code: ---
LIBRARY sqlite3
EXPORTS
sqlite3_aggregate_context
sqlite3_aggregate_count
...

--- End code ---


Save it. You can give it a new name, so you have a copy if something goes wrong. Put it in the directory where the sqlite dll is.

Now you need a Dos console and the directory for polib.exe and the directory where you have extracted the sqlite stuff.

- Open the console, type in the path and name for polib.exe
- Add "/DEF:" + the path to the sqlite.def file (or the new name if you have renamed it)
- Add "/OUT:" + the new path and name for the lib which will be generated.

This could look like:

--- Quote ---K:\>E:\Programme\PellesC\Bin\polib.exe /DEF:E:\Programme\PellesC\Projects\sqlite\sqlite3.txt /OUT:E:\Programme\PellesC\Projects\sqlite\sqlite3.lib
--- End quote ---


Hit enter and this is the output:

--- Code: ---POLIB: warning: /MACHINE not specified; assuming IX86.
--- End code ---


Except that little warning it seems to be ok and you can use now your new generated lib file and the sqlite dll in your projects.

Congratulations!

TheRaven:
You could simply load the sqlite3.dll at run time then get handles to the dll exports; works for me.
I generally do the dynamic run time route remembering to consult the official SQLite3 API and it (SQLite) likes Unicode now.

Good stuff regardless, nice tut/example!

Navigation

[0] Message Index

Go to full version