News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Sqlite 3 with PellesC

Started by kobold, March 21, 2006, 08:27:43 PM

Previous topic - Next topic

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:

EXPORTS
sqlite3_aggregate_context
sqlite3_aggregate_count
...


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

After that it looks like:


LIBRARY sqlite3
EXPORTS
sqlite3_aggregate_context
sqlite3_aggregate_count
...


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:
QuoteK:\>E:\Programme\PellesC\Bin\polib.exe /DEF:E:\Programme\PellesC\Projects\sqlite\sqlite3.txt /OUT:E:\Programme\PellesC\Projects\sqlite\sqlite3.lib

Hit enter and this is the output:
POLIB: warning: /MACHINE not specified; assuming IX86.

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!