Blog de Flap

18/09/2008

sqlite et C++ builder 6

Filed under: Embarqué — flap @ 14:37
Eli Wheaton wrote:
> I'm having a problem trying to get SQLite to work with a C++Builder6
> project.
> Does anyone have any advice on how to do this?

Hi Eli,

I am using Borland's BCB6 with SQLite.

I have built SQLite DLL's using both the Borland compiler, and also the
MinGW/Msys tool set. I currently use MinGW to build the DLL from CVS source,
since it is simpler to use. The current SQLite Makefile has an implib target
which will build the import library that the Borland compiler needs to link
against the DLL.

If you don't need to build SQLite from source you can simply download the
current SQLite.DLL library from the web site
http://www.hwaci.com/sw/sqlite/download.html. You will also need the
sqlite.h header file which is included in the sqlite_source.zip file that
you can download from the same site.

To build a project that uses the DLL you will need to generate a Borland
import library. BCB6 comes with a command line tool called implib that will
do this. Simply open a command promt window, change to the directory where
the DLL is located, and run the following command (assuming that the Borland
bin directory is on your path);

implib -a sqlite.lib sqlite.dll

The -a argument is required to generate the correct symbol names in the
import library.

Now create a project that uses SQLite. The sample code at
http://www.hwaci.com/sw/sqlite/quickstart.html should work just fine for a
test. You will need to make sure the project options have the path to the
sqlite.h include file, and the path to the sqlite.lib library files set.
Build your project to generate your executable. Finally, you need to copy
the SQLite.DLL file into the same directory as your executable (or into the
Windows/System directory) since that is where Windows will look for the DLL.

You can now run your program, and it should create an SQLite database and
execute the SQL statement you give it.

Good luck.

4 Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.

Powered by WordPress