Page 1 of 1
Statically linking SQLite possible?
Posted: Mon Mar 15, 2004 3:09 pm
by dell_jockey
Hi Group,
the last couple of weeks, I've been testing SQLite. I indent to make it part of an application of mine.
I've noticed that Kapital (
http://www.kapital-billing.com/), a very nice billing application written by forum member Karbon uses SQLite, but apparently doesn't contain the sqlite.dll in the distribution. This leads me to the assuption, that SQLite can somehow be statically linked.
I searched this forum and read the SQLite docuementation, but couldn't find out how to statically link in SQLite.
I'd very much like to learn about how to do it!
Thanks!
Posted: Mon Mar 15, 2004 5:11 pm
by Edwin Knoppert
Posted: Mon Mar 15, 2004 5:36 pm
by dell_jockey
bedankt Edwin!
your link made me re-think my options: it is possible to link in the DLL as a binary resource, and have the application copy this binary resource into a memory mapped file after start-up. The next step would be to have that application use memory mapped DLL's it copied there itself.
Would that be possible somehow?
Posted: Mon Mar 15, 2004 10:46 pm
by Edwin Knoppert
Check all of my posts here, one of them shows a way to load dll's like PEBundle.
I believe SQLite doesn't work with it..?
Posted: Tue Mar 16, 2004 4:55 pm
by ebs
dell_jockey,
If it's OK to extract the sqlite.dll file from your executable and write it to a disk file, you can do this:
Code: Select all
;- make sure SQLite DLL is present and initialized
Procedure.l SQLiteInit()
; check if SQLite DLL is present
If FileSize("sqlite.dll") = -1
; not present - extract DLL and write to disk
If OpenFile(1, "sqlite.dll")
WriteData(?SQLite, ?SQLiteEnd-?SQLite)
CloseFile(1)
Else
MessageRequester("SQLite Error", "Can't write DLL file", #MB_ICONERROR | #MB_OK)
ProcedureReturn #False
EndIf
EndIf
; load/init SQLite DLL
ProcedureReturn InitSQLite("sqlite.dll")
EndProcedure
*
*
*
SQLite:
IncludeBinary "sqlite.dll"
SQLiteEnd:
It isn't quite as convenient as static linking, but it works!
Regards,
Eric
Posted: Wed Mar 17, 2004 4:27 am
by Karbon
Well, thanks for the kind words
My software bundles the SQLite DLL with the EXE using some 3rd party software - it's not really statically linked after all!
Posted: Wed Mar 17, 2004 2:50 pm
by dell_jockey
Hi Mitch,
thanks for your reply. I like Kapital a lot, so you deserve a thumbs-up!.
Edwin recommended PEbundle. Do you use the same product or could you perhaps recommend others?