SQLite as PB lib ? Single Executable.

Everything else that doesn't fall into one of the other PB categories.
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

SQLite as PB lib ? Single Executable.

Post by USCode »

Using a tool like this that Fr34k has put together:
http://freak.purearea.net/tools/

And since the source code to SQLite is readily available...

:?: Wouldn't it be possible to compile SQLite into a .lib or .obj file using a C compiler, then combine that with El Choni's SQLite library, run Fr34ks tool and "viola" - create a PB library that could be linked by PB with your PB application all into a single executable? Just like any other PB library?

Rather than importing/exporting the SQLite DLL, etc. as has been discussed here in the past.

Just a thought.

( Caveat: I am PB library ignorant, so I apologize in advance if this question doesn't make any sense. )
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

ElChoni has a SQLite userlib already that does that. It might be possible to statically link the SQLite library into a PB executable, though I don't know how.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Post by USCode »

ElChoni has a SQLite userlib already that does that
Hi Karbon,
Yeah, I'm aware of El Choni's library but what I was driving at was combining El Choni's SQLite interface library and statically linking SQLite into the executable. Some folks have brought SQLite into the data section and writing it out at runtime, etc. but I was looking for a method to formally link it in as part of the executable.
Thanks
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Since the SQLite dll C source is available, you could implement it as a Purelibrary, entirely.

You only need some spare time XD

EDIT: I don't know if the SQLite license allows this.
El_Choni
pbSync
New User
New User
Posts: 4
Joined: Thu Jun 17, 2004 5:25 pm

Post by pbSync »

USCode wrote:
ElChoni has a SQLite userlib already that does that
Hi Karbon,
Yeah, I'm aware of El Choni's library but what I was driving at was combining El Choni's SQLite interface library and statically linking SQLite into the executable. Some folks have brought SQLite into the data section and writing it out at runtime, etc. but I was looking for a method to formally link it in as part of the executable.
Thanks

Quick solution to bundle a dll with your exe could be this tool: http://www.collakesoftware.com/pebundle.htm

don't know, whether this works or is allowed.
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Post by USCode »

Quick solution to bundle a dll with your exe could be this tool: http://www.collakesoftware.com/pebundle.htm
Thanks pbSync and I've seen that discussed is other threads but I wanted SQLite to be a first-class PB library.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

But as PE bundle cost some $ you can do this entirely free in PB.
Its very simple to do it, just requires 5 line of simple code.
User avatar
HAnil
User
User
Posts: 87
Joined: Thu Feb 26, 2004 5:42 pm
Location: 28:58E 41:01N

Post by HAnil »

thefool wrote: Its very simple to do it, just requires 5 line of simple code.
would you like to share this 5 line code.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Sorry. It was 8 lines of code :D

but here it is, with comments. Just remove those, though..

Code: Select all

;This creates the file.
;Replace "test.txt" with anything else.
CreateFile(1,"test.txt")
WriteData(?startfile,?endfile-?startfile)
CloseFile(1)

;This has to be putted after the createfile()
;I always put it in the bottom of the file.
;Rename "test.txt" to any file you want.
;Remember you need to have the file in the dir
;with the sourcecode.
DataSection
startfile:
IncludeBinary "test.txt"
endfile:
EndDataSection
But if you have to use this for a DLL, you need to do the createfile()
before calling it. But this also works for exe and any other file.
pbSync
New User
New User
Posts: 4
Joined: Thu Jun 17, 2004 5:25 pm

Post by pbSync »

thefool wrote:But as PE bundle cost some $ you can do this entirely free in PB.
Its very simple to do it, just requires 5 line of simple code.
Writing to disk is easy in pb. But PE Bundle extracts the DLL direct to memory, which feels more like a lib and is not so easy to do in pb (at least I don't know how to do it). So it has its uses.
Post Reply