C++ compiler

classic Classic list List threaded Threaded
9 messages Options
eli
Reply | Threaded
Open this post in threaded view
|

C++ compiler

eli
Hello,

It would be awesome if SQLite could compile as a part of bigger C++ project.
Right now there is a bunch of pointer casting errors, that can be fixed in
a matter of hour IMHO.

Cheers,
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: C++ compiler

John McKown
On Sat, Dec 30, 2017 at 5:35 AM, eli <[hidden email]> wrote:

> Hello,
>
> It would be awesome if SQLite could compile as a part of bigger C++
> project.
> Right now there is a bunch of pointer casting errors, that can be fixed in
> a matter of hour IMHO.
>

​I'm not a very knowledgeable C++ programmer, but wouldn't a simple:

extern C {
...
... SQLite definitions
...
}

be a way to do it?

Or maybe I'm simplifying your question too much (wouldn't be the first time
for me).​



>
> Cheers,
>


--
I have a theory that it's impossible to prove anything, but I can't prove
it.

Maranatha! <><
John McKown
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: C++ compiler

Nelson, Erik - 2
In reply to this post by eli
Eli Sent: Saturday, December 30, 2017 6:36 AM

>It would be awesome if SQLite could compile as a part of bigger C++ project.
>Right now there is a bunch of pointer casting errors, that can be fixed in
>a matter of hour IMHO.

I don't have any trouble using it as part of a larger C++ project.

----------------------------------------------------------------------
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended recipient, please delete this message.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: C++ compiler

Igor Korot
In reply to this post by eli
Hi,

On Sat, Dec 30, 2017 at 5:35 AM, eli <[hidden email]> wrote:
> Hello,
>
> It would be awesome if SQLite could compile as a part of bigger C++ project.
> Right now there is a bunch of pointer casting errors, that can be fixed in
> a matter of hour IMHO.

Which OS/compiler are you trying?
What is the exact error message you are receiving?
Did you modify t code in any way?

Thank you.

>
> Cheers,
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: C++ compiler

Simon Slavin-3
In reply to this post by eli


On 30 Dec 2017, at 11:35am, eli <[hidden email]> wrote:

> It would be awesome if SQLite could compile as a part of bigger C++ project.

It can.  It should work fine.  This is the main way SQLite is intended to be used.  Download the "amalgamation" source code (one .h and one .c file) and include them in your project.

The only problem is making sure your compiler understands that a file ending in ".c" is C source code, not C++ source code.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: C++ compiler

Deon Brewis
In reply to this post by Nelson, Erik - 2
Ditto. Large C++ project - no problem using SQLite.

Are you trying to compile sqlite.c as a C++ file? That won't work obviously, you have to compile as C and link it in.

The sqlite3.h header however can be pulled into any C++ file.

- Deon

-----Original Message-----
From: sqlite-users [mailto:[hidden email]] On Behalf Of Nelson, Erik - 2
Sent: Tuesday, January 2, 2018 9:50 AM
To: SQLite mailing list <[hidden email]>
Subject: Re: [sqlite] C++ compiler

Eli Sent: Saturday, December 30, 2017 6:36 AM

>It would be awesome if SQLite could compile as a part of bigger C++ project.
>Right now there is a bunch of pointer casting errors, that can be fixed
>in a matter of hour IMHO.

I don't have any trouble using it as part of a larger C++ project.

----------------------------------------------------------------------
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.bankofamerica.com%2Femaildisclaimer&data=02%7C01%7C%7C8d0be66235844225ba0508d552094785%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636505122160488357&sdata=O5qNYHgSsFYXspXcltee5v9RKF4SKqIru%2BPY%2FRWyHrY%3D&reserved=0.   If you are not the intended recipient, please delete this message.
_______________________________________________
sqlite-users mailing list
[hidden email]
https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmailinglists.sqlite.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsqlite-users&data=02%7C01%7C%7C8d0be66235844225ba0508d552094785%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636505122160488357&sdata=xij9z7ZYvd5j7T5L1Ygo63BNeQPGYPbcx3eLCate8LI%3D&reserved=0
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Database Variable

Gregory Moore-3
In reply to this post by John McKown
Hi

I have an Objective-C iPhone application developed using Xcode. I have a singleton object which serves as the database controller. I use the SQLite C APIs to interact with the database. It works really well but I’m curious about something.

In my app, I declare my database instance variable like this. (It is a member of the DatabaseController class)

sqlite3 *_database;

My usage is like this:

int openCode = sqlite3_open(databasePathC, &_database);

I was poking around in FMDB’s source code on github. FMDB is a widely used Objective-C wrapper around SQLite. I was looking to see what they do out of curiosity.  FMDB declares and uses the database variable like this:

void *_database;

int openCode = sqlite3_open(databasePathC, (sqlite3**)&_database);

So my question is this: is there some advantage to declaring the database variable as a void pointer and casting it as sqlite3 verses just declaring it as sqlite3?

Thanks for creating SQLite!

Greg Moore
[hidden email]

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
ajm
Reply | Threaded
Open this post in threaded view
|

Re: C++ compiler

ajm
In reply to this post by eli
Hi:

Not only it can, but that is probably the use in the 99.00% of C++ applications that uses SQLite.

The only caveat is that you can get some warnings depending on the compiler you use.

Cheers

--
Adolfo J. Millan

>
> ---- Mensaje original ----
> De: eli <[hidden email]>
> Para:  [hidden email]
> Fecha:  Sat, 30 Dec 2017 13:35:35 +0200
> Asunto:  [sqlite] C++ compiler
>
> Hello,

It would be awesome if SQLite could compile as a part of bigger C++ project.
Right now there is a bunch of pointer casting errors, that can be fixed in
a matter of hour IMHO.

Cheers,
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: C++ compiler

Igor Korot
Hi,

On Tue, Jan 2, 2018 at 3:34 PM,  <[hidden email]> wrote:
> Hi:
>
> Not only it can, but that is probably the use in the 99.00% of C++ applications that uses SQLite.

That number should probably be 99.9999999(9)%... ;-)

Thank you.

>
> The only caveat is that you can get some warnings depending on the compiler you use.
>
> Cheers
>
> --
> Adolfo J. Millan
>
>>
>> ---- Mensaje original ----
>> De: eli <[hidden email]>
>> Para:  [hidden email]
>> Fecha:  Sat, 30 Dec 2017 13:35:35 +0200
>> Asunto:  [sqlite] C++ compiler
>>
>> Hello,
>
> It would be awesome if SQLite could compile as a part of bigger C++ project.
> Right now there is a bunch of pointer casting errors, that can be fixed in
> a matter of hour IMHO.
>
> Cheers,
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users