Hi Jonathan,

I don't use Borland C, so I can' help you with the specifics of that compiler.

But no, you don't necessarily get an executable just by compiling with a C compiler. You should be able to compile SQLite with a C compiler, and in the process obtain one or more .o files. (Perhaps they are called .obj in Borland C.)

With the GNU C compiler (and many other compilers), the switch to create a .o file instead of an executable is -c. Maybe this translates to /c on Borland C, but you'd have to consult your Borland C manual for that.

These .o/.obj files can be linked into your C++ program. If you follow Joe Wilson's advice and just #include <sqlite3.h> from within C++, it should work.

That is exactly what the 'extern "C"' clause is for in C++: It tells the C++ compiler that the functions within the 'extern "C" { ... }' block were compiled with a compiler that emits code with C calling conventions. This enables calling C code from within C++. As you probably know, calling conventions have to do with, among other things, the way function parameters are put on the stack, and the way any return value is returned.

HTH

Regards,

Ulrik Petersen


Jonathan Kahn wrote:
Hi Ulrik,
  Thank you for responding.  I'll try anything!  The frustration that all
this has brought me I am determined to solve it.
  If I built SQLite with a C compiler what would be the result?  What would
I be able to work with from within c++?  Won't compiling leave me with an
executable?  I am fairly new to dealing with different compilers and things,
so please forgive my ignorance.
Thanks a lot,
- Jon


-----Original Message-----
From: Ulrik Petersen [mailto:[EMAIL PROTECTED] Sent: Sunday, April 29, 2007 2:29 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] sqlite and borland c++ builder

Hi Jon,

is it not an option to build SQLite with a C compiler, then call it from within C++?


Regards,

Ulrik Petersen


Jonathan Kahn wrote:
Even when I try to build a new dll I get errors with attach.c and it says
cannot convert 'void *' to 'Db *', no matter what route I take I always
hit
a bump.  I'm just trying anything at this point

- Jon

-----Original Message-----
From: Joe Wilson [mailto:[EMAIL PROTECTED] Sent: Sunday, April 29, 2007 1:59 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] sqlite and borland c++ builder
I wrote too quickly - sqlite3.h correctly uses __cplusplus for extern "C".

But the almalgomated sqlite3.c cannot be compiled from a C++ compiler
for the reasons described below.

--- Joe Wilson <[EMAIL PROTECTED]> wrote:
  When I try to use the header I get errors

 [C++ Error] sqlite3.h(1778): E2232 Constant member
'sqlite3_index_info::nConstraint' in class without constructors
It appears it is trying to compile the sqlite header file as if it were
C++.
Lemme guess - you're using the almalgomated sqlite3.c from 3.3.17, right?

from the generated sqlite3.c:

 /*
 ** Make sure we can call this stuff from C++.
 */
 #if 0
 extern "C" {
 #endif

See the #if 0? That's the problem. It should be:

 #if __cplusplus

SQLite 3.3.17 has a bug in sqlite3.c generation.
To work around this issue, do this:

 extern "C" {
 #include "sqlite3.h"
 }


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

----------------------------------------------------------------------------
-
To unsubscribe, send email to [EMAIL PROTECTED]

----------------------------------------------------------------------------
-
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

----------------------------------------------------------------------------
-
To unsubscribe, send email to [EMAIL PROTECTED]

----------------------------------------------------------------------------
-



----------------------------------------------------------------------------
-
To unsubscribe, send email to [EMAIL PROTECTED]

----------------------------------------------------------------------------
-


----------------------------------------------------------------------------
-
To unsubscribe, send email to [EMAIL PROTECTED]
----------------------------------------------------------------------------
-


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------




-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to