What languages can include SQLite statically?

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

What languages can include SQLite statically?

Gilles Ganault-3
Hello

My C skills are very basic. I was wondering: After compiling SQLite
into an .OBJ or .LIB file, what languages can be used to include this
output into a main program, so we end up with a single EXE.

I assume we have the choice of:
- C
- C++
- Delphi (?)
- Other?

Thank you.

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

Re: What languages can include SQLite statically?

Arjen Markus-3
Hi Gilles,

I do not quite understand why this is important to you, but the answer
is independent of SQLite itself - and it is a trifle complicated.

You can add Fortran to the list below - either a static or a dynamic
library will do fine.

If you look at Tcl, the matter becomes more complicated:
- Tcl supports static packages, in which case you can add a static
   library to the link step (and add a call to the proper Tcl functions
   to initialise it).
- Tcl also supports dynamically loading packages, in which case you
   need a dynamic library. But, and here comes the complication, you
   can also wrap the Tcl runtime executable and all (!) its dependencies
   into a single file. In fact there are various options to do so,
   for instance via Tclkit (you get a so-called starkit then).
   Does that count as a single EXE? You only need to distribute a
   single file - but there is still a dynamic library in there
   somewhere.

I am not very familiar with other dynamic languages (scripting
languages if you want), but I understand they have similar
technologies.

A language where this is definitely not possible is Java. There
you need to supply separate jar-files and native libraries. But
again, that is a matter of the _language mechanisms_, not of
SQLite. (The same for C#, if I am not grossly mistaken)

Regards,

Arjen

On 2010-05-21 11:31, Gilles Ganault wrote:

> Hello
>
> My C skills are very basic. I was wondering: After compiling SQLite
> into an .OBJ or .LIB file, what languages can be used to include this
> output into a main program, so we end up with a single EXE.
>
> I assume we have the choice of:
> - C
> - C++
> - Delphi (?)
> - Other?
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: What languages can include SQLite statically?

Jean-Denis Muys-2
In reply to this post by Gilles Ganault-3
Well the answer is: any language with an external interface to the C ABI can
link to the SQLite compiled C object code (on my planet they don't have .OBJ
nor .LIB extensions. Perhaps we are not on the same planet) to yield an
executable (I guess that's what you mean by 'EXE').

That include any C-family language of course: C, C++, Objective-C. Or even
Go, though it's difficult to classify Go in the C family.

It should also be possible in Fortran for example, not that I can think of a
good use case :-).

Perhaps more usefuly, Etoilé is a Smalltalk dialect using the GNU-Step ABI,
which was designed for Objective-C, so should be able to link with SQLite
directly.

I can do it with MacRuby too, since MacRuby is compiled to native code using
the standard Mac OS X ABI.

In MacRuby's tracks, it's become much easier to do so with any language,
using LLVM.

Of course, the other half of the equation is how do you call a SQLite
function from the other language. At least, that implies creating an
'interface' file from the header.

In fact it's not so much the language that's relevant here, rather the
run-time architecture your particular implementation of that language uses:
if that run-time supports a standard-compliant C compiler, then you should
be good to go.

Jean-Denis

On 5/21/10 11:31 , "Gilles Ganault" <[hidden email]> wrote:

> Hello
>
> My C skills are very basic. I was wondering: After compiling SQLite
> into an .OBJ or .LIB file, what languages can be used to include this
> output into a main program, so we end up with a single EXE.
>
> I assume we have the choice of:
> - C
> - C++
> - Delphi (?)
> - Other?
>
> Thank you.
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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

Re: What languages can include SQLite statically?

Gilles Ganault-3
On Fri, 21 May 2010 12:11:39 +0200, Jean-Denis Muys
<[hidden email]> wrote:
>Well the answer is: any language with an external interface to the C ABI can
>link to the SQLite compiled C object code

Thanks for the explanation. Ideally, the executable should be a
simpler language than C that would still be able to include SQLite so
that I would end up with a single executable.

Apparently, there are two solutions:
- use C/C++, and just include sqlite.c + sqlite.h in the project
- compile the SQLite source code into OBJ, compile this OBJ with the
executable, and somehow call the SQLite functions from the main
program.

Does someone know of a BASIC-like language (ie. with an easy syntax
like Python, Lua, etc.) that can include the SQLite OBJ file?

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

Re: What languages can include SQLite statically?

Simon Slavin-3

On 21 May 2010, at 11:19am, Gilles Ganault wrote:

> Ideally, the executable should be a
> simpler language than C that would still be able to include SQLite so
> that I would end up with a single executable.

The SQLite library is provided as one long piece of C code.  Not even C++, just C, with a couple of includes.  So any language for which you can write extensions in C will handle SQLite just fine.

> Apparently, there are two solutions:
> - use C/C++, and just include sqlite.c + sqlite.h in the project

Yep.  That is the simplest way to do it and gives a compact result.

> - compile the SQLite source code into OBJ, compile this OBJ with the
> executable, and somehow call the SQLite functions from the main
> program.

Or write a little bridge which converts your programs requirements into a few calls to the SQLite library, then compile your bridge as a static library.

> Does someone know of a BASIC-like language (ie. with an easy syntax
> like Python, Lua, etc.) that can include the SQLite OBJ file?

Hard to know what you mean by BASIC-like, but I can name languages you can do this in off the top of my head, including the two you named.  For instance, get hold of the lua source code, and add SQLite and a few bridge functions to convert data from SQLite format to lua's indexed table format.

Not to mention using non-language applications and writing a plugin which incorporates SQLite, as you can do for Final Cut Pro, FireFox, Safari, MatLab, etc..  I wanted a way to call SQLite from JavaScript in Safari so I wrote a browser plugin.  Works fine.

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

Re: What languages can include SQLite statically?

Michael Schlenker-4
In reply to this post by Gilles Ganault-3
Gilles Ganault schrieb:

> On Fri, 21 May 2010 12:11:39 +0200, Jean-Denis Muys
> <[hidden email]> wrote:
>> Well the answer is: any language with an external interface to the C ABI can
>> link to the SQLite compiled C object code
>
> Thanks for the explanation. Ideally, the executable should be a
> simpler language than C that would still be able to include SQLite so
> that I would end up with a single executable.
>
> Apparently, there are two solutions:
> - use C/C++, and just include sqlite.c + sqlite.h in the project
> - compile the SQLite source code into OBJ, compile this OBJ with the
> executable, and somehow call the SQLite functions from the main
> program.
>
> Does someone know of a BASIC-like language (ie. with an easy syntax
> like Python, Lua, etc.) that can include the SQLite OBJ file?

Well, Tcl/Tk is one solution with an easy syntax and good sqlite
support. If you used starkits/starpacks you can wrap all those things up
into single file executables on many platforms easily too.

But Python, Lua etc. have useful SQLite bindings too, so pick whatever
language you feel comfortable with, most have a working SQLite binding.

Michael

--
Michael Schlenker
Software Architect

CONTACT Software GmbH           Tel.:   +49 (421) 20153-80
Wiener Straße 1-3               Fax:    +49 (421) 20153-41
28359 Bremen
http://www.contact.de/          E-Mail: [hidden email]

Sitz der Gesellschaft: Bremen
Geschäftsführer: Karl Heinz Zachries, Ralf Holtgrefe
Eingetragen im Handelsregister des Amtsgerichts Bremen unter HRB 13215
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: What languages can include SQLite statically?

Black, Michael (IS)
In reply to this post by Gilles Ganault-3
It looks like FreeBasic should work
http://www.freebasic.net/
 
You just have to build the include file -- hopefully that's not too hard for you as you probably only need a few of the functions.
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 

________________________________

From: [hidden email] on behalf of Gilles Ganault
Sent: Fri 5/21/2010 5:19 AM
To: [hidden email]
Subject: Re: [sqlite] What languages can include SQLite statically?



On Fri, 21 May 2010 12:11:39 +0200, Jean-Denis Muys
<[hidden email]> wrote:
>Well the answer is: any language with an external interface to the C ABI can
>link to the SQLite compiled C object code

Thanks for the explanation. Ideally, the executable should be a
simpler language than C that would still be able to include SQLite so
that I would end up with a single executable.

Apparently, there are two solutions:
- use C/C++, and just include sqlite.c + sqlite.h in the project
- compile the SQLite source code into OBJ, compile this OBJ with the
executable, and somehow call the SQLite functions from the main
program.

Does someone know of a BASIC-like language (ie. with an easy syntax
like Python, Lua, etc.) that can include the SQLite OBJ file?

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



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

Re: What languages can include SQLite statically?

Gilles Ganault-3
On Fri, 21 May 2010 06:28:20 -0500, "Black, Michael (IS)"
<[hidden email]> wrote:
>It looks like FreeBasic should work
>http://www.freebasic.net/
>
>You just have to build the include file -- hopefully that's not too hard for you as you probably only need a few of the functions.

I'll give it a try. Thanks everyone.

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

Re: What languages can include SQLite statically?

Black, Michael (IS)
Looks like somebody already did the include files....and an example too...hopefully works for you out-of-the-box.
http://www.freebasic.net/forum/viewtopic.php?p=101439
 
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 

________________________________

From: [hidden email] on behalf of Gilles Ganault
Sent: Fri 5/21/2010 6:41 AM
To: [hidden email]
Subject: Re: [sqlite] What languages can include SQLite statically?



On Fri, 21 May 2010 06:28:20 -0500, "Black, Michael (IS)"
<[hidden email]> wrote:
>It looks like FreeBasic should work
>http://www.freebasic.net/
>
>You just have to build the include file -- hopefully that's not too hard for you as you probably only need a few of the functions.

I'll give it a try. Thanks everyone.

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



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

Re: What languages can include SQLite statically?

Black, Michael (IS)
I took a look at freebasic and sqlite3 support is already included
./examples/libraries/DB/sqlite3_test.bas

And it worked for me on my Linux system.
 
You need to just compile sqlite3.c into a linkable library or add sqlite3.o to your compile line.
 
So you can do
fbc sqlite3_test.bas -lsqlite3
Or
fbc sqlite3_test.bas sqlite3.o
 
You didn't say what plafform you're running on so I assume 32-bit Windows?
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 

________________________________

From: [hidden email] on behalf of Black, Michael (IS)
Sent: Fri 5/21/2010 6:52 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] What languages can include SQLite statically?



Looks like somebody already did the include files....and an example too...hopefully works for you out-of-the-box.
http://www.freebasic.net/forum/viewtopic.php?p=101439


Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems


________________________________

From: [hidden email] on behalf of Gilles Ganault
Sent: Fri 5/21/2010 6:41 AM
To: [hidden email]
Subject: Re: [sqlite] What languages can include SQLite statically?



On Fri, 21 May 2010 06:28:20 -0500, "Black, Michael (IS)"
<[hidden email]> wrote:
>It looks like FreeBasic should work
>http://www.freebasic.net/
>
>You just have to build the include file -- hopefully that's not too hard for you as you probably only need a few of the functions.

I'll give it a try. Thanks everyone.

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





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

Re: What languages can include SQLite statically?

ajm
In reply to this post by Gilles Ganault-3
Not to say that in PHP you can't link any thing. But perhaps respond to your
condition of a simpler language than C that would still be able to include
SQLite.

There you end with a single script, not an stand alone executable.

A.J.Millan

----- Original Message -----
From: "Gilles Ganault" <[hidden email]>
To: <[hidden email]>
Sent: Friday, May 21, 2010 11:31 AM
Subject: [sqlite] What languages can include SQLite statically?


> Hello
>
> My C skills are very basic. I was wondering: After compiling SQLite
> into an .OBJ or .LIB file, what languages can be used to include this
> output into a main program, so we end up with a single EXE.
>
> I assume we have the choice of:
> - C
> - C++
> - Delphi (?)
> - Other?
>
> Thank you.
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 

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

Re: What languages can include SQLite statically?

Arjen Markus-3
In reply to this post by Jean-Denis Muys-2
Hi,

On 2010-05-21 12:11, Jean-Denis Muys wrote:

> Well the answer is: any language with an external interface to the C ABI can
> link to the SQLite compiled C object code (on my planet they don't have .OBJ
> nor .LIB extensions. Perhaps we are not on the same planet) to yield an
> executable (I guess that's what you mean by 'EXE').
>
> That include any C-family language of course: C, C++, Objective-C. Or even
> Go, though it's difficult to classify Go in the C family.
>
> It should also be possible in Fortran for example, not that I can think of a
> good use case :-).
>

Well, depending on your planet this can be said for any language :), but
it is indeed possible to use SQLite3 in a Fortran program. There are
actually two different bindings that I know of (one is my own -
http://flibs.sf.net).

Regards,

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

Re: What languages can include SQLite statically?

Gilles Ganault-3
In reply to this post by Black, Michael (IS)
On Fri, 21 May 2010 07:13:48 -0500, "Black, Michael (IS)"
<[hidden email]> wrote:

>I took a look at freebasic and sqlite3 support is already included
>./examples/libraries/DB/sqlite3_test.bas
>
>And it worked for me on my Linux system.
>
>You need to just compile sqlite3.c into a linkable library or add sqlite3.o to your compile line.
>
>So you can do
>fbc sqlite3_test.bas -lsqlite3
>Or
>fbc sqlite3_test.bas sqlite3.o
>
>You didn't say what plafform you're running on so I assume 32-bit Windows?

Thanks a lot. I'll try to compile a prototype in FB for Windows and
see how it goes.

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

Re: What languages can include SQLite statically?

Gilles Ganault-3
In reply to this post by ajm
On Fri, 21 May 2010 14:34:56 +0200, "A.J.Millan"
<[hidden email]> wrote:
>Not to say that in PHP you can't link any thing. But perhaps respond to your
>condition of a simpler language than C that would still be able to include
>SQLite.
>
>There you end with a single script, not an stand alone executable.

Right, but PHP would require a lot more bagage than a stand-alone
executable. I'll try the different solutions provided in this thread.

Thank you.

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

Re: What languages can include SQLite statically?

Peter Rodwell-2
In reply to this post by Gilles Ganault-3
Quoting A.J.Millan:

> Thanks but I'd like to pack the main application and SQLite into a
> single executable, so languages like Python, PHP, etc. aren't good
> solutions.

Take a look at REALbasic (http://www.realsoftware.com/), now called
REALStudio. It has SQLite support built in (and support for other
dabases such as MySQL). The same source code can be compiled simultaneously
for Windows (32-bit only for now), Linux and Mac.

Just my €0.02 worth.

Peter.


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

Re: What languages can include SQLite statically?

Max Vlasov
In reply to this post by Gilles Ganault-3
Gilles,

For Delphi I successfully used files from http://www.aducom.com to
statically link sqlite files compiled with bcc (Borland command-line c
compiler freely available now) with Delphi. Also the components of
aducom.com will allow you to use all the power of Delphi database components
with the sqlite without necessity to provide any additional dlls.

But there are some adjustments needed, if you use c run-time from msvcrt dll
(the forum at aducom.com shows how to do this), no other actions needed. But
if you want to be free from msvcrt dependency, you can use c-runtime object
files also available on aducom.com, but the version I used had a serious
bug, Albert (from aducom.com) promised to fix on the site, probably you can
use it as of now.

Max
maxerist.net


On Fri, May 21, 2010 at 1:31 PM, Gilles Ganault <[hidden email]>wrote:

> Hello
>
> My C skills are very basic. I was wondering: After compiling SQLite
> into an .OBJ or .LIB file, what languages can be used to include this
> output into a main program, so we end up with a single EXE.
>
> I assume we have the choice of:
> - C
> - C++
> - Delphi (?)
> - Other?
>
> Thank you.
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: What languages can include SQLite statically?

Gilles Ganault-3
In reply to this post by Peter Rodwell-2
On Sat, 22 May 2010 14:09:18 +0200, Peter Rodwell
<[hidden email]> wrote:
>Take a look at REALbasic (http://www.realsoftware.com/), now called
>REALStudio. It has SQLite support built in (and support for other
>dabases such as MySQL). The same source code can be compiled simultaneously
>for Windows (32-bit only for now), Linux and Mac.

Thanks for the tip. However, it's proprietary and a bit pricey, so I'd
rather investigate writing an HTTP + SQLite combo before choosing that
solution.

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

Re: What languages can include SQLite statically?

Gilles Ganault-3
In reply to this post by Max Vlasov
On Mon, 24 May 2010 12:28:14 +0400, Max Vlasov
<[hidden email]> wrote:
>For Delphi I successfully used files from http://www.aducom.com to
>statically link sqlite files compiled with bcc (Borland command-line c
>compiler freely available now) with Delphi. Also the components of
>aducom.com will allow you to use all the power of Delphi database components
>with the sqlite without necessity to provide any additional dlls.

Thanks for the tip. The problem is that I'd like a cross-platform
solution so that the HTTP + SQLite solution runs on Windows and Linux
(and in the case of Linux, ideally, should also compile on platforms
other than x86 such as embedded devices).

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

Re: What languages can include SQLite statically?

Black, Michael (IS)
About the only thing you'll find cross-platform + embedded is C/C++
 
For an IDE use Code::Blocks as it is cross-platform Windows/Unix (no embedded though of course).  But does run gcc on both.  And since gcc is a popular choice for embedded that will maximize your code portability.
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 

________________________________

From: [hidden email] on behalf of Gilles Ganault
Sent: Tue 6/1/2010 4:30 AM
To: [hidden email]
Subject: Re: [sqlite] What languages can include SQLite statically?



On Mon, 24 May 2010 12:28:14 +0400, Max Vlasov
<[hidden email]> wrote:
>For Delphi I successfully used files from http://www.aducom.com <http://www.aducom.com/>  to
>statically link sqlite files compiled with bcc (Borland command-line c
>compiler freely available now) with Delphi. Also the components of
>aducom.com will allow you to use all the power of Delphi database components
>with the sqlite without necessity to provide any additional dlls.

Thanks for the tip. The problem is that I'd like a cross-platform
solution so that the HTTP + SQLite solution runs on Windows and Linux
(and in the case of Linux, ideally, should also compile on platforms
other than x86 such as embedded devices).

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



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

Re: What languages can include SQLite statically?

Simon Slavin-3
In reply to this post by Gilles Ganault-3

On 1 Jun 2010, at 10:30am, Gilles Ganault wrote:

> The problem is that I'd like a cross-platform
> solution so that the HTTP + SQLite solution runs on Windows and Linux

The obvious solution is to use PHP, and have it use one of the three avaialable sets of SQLite calls.

> (and in the case of Linux, ideally, should also compile on platforms
> other than x86 such as embedded devices).

That's harder.  You could use Zend, I suppose.  Zend is the actual language PHP supports.  PHP is just the Zend programming language implemented as an Apache module.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
12