About
editFb_embedded2.pas is a Pascal unit that can be included in a Lazarus project to enable embedding of Firebird (version 2.0.3) database server (a.k.a. DBMS) into an .exe file, without need for distributing any DLL.
The original code for Delphi was created by Fikret Hasovic and Samir Ribic, modified by Zlatko Matic (matalab@gmail.com) for FPC/Lazarus.
You do not need this to use the "regular" embedded Firebird database.
Download
edit@ Lazurus CCR SourceForge repository (file: fb_embedded2_Laz_1_0.zip).
Introduction
editCurrently, fb_embedded2.pas works only on Windows. It reads lib from memory stream.
When you unpack the zipped file fb_embedded2_Laz_1_0.zip, you will see it contains everything needed for embedding Firebird 2.0.3 into your .exe:
- Firebird embedded 2.0.3: all required DLLs,
fb_embedded2.pas: unit to be included into your Lazarus project,FB_Embedded.rc:> textual file to be converted to Windows resource file,FB_Embedded.res: Windows resource file, used byfb_embedded2.pas,- windres utility: used to create
FB_Embedded.resfromFB_Embedded.rc, fb_embedded.bat: createsFB_Embedded.res,- several other
.pasand.ppfiles that should be included into your project.
These are files from
C:\lazarus\debugger\windebugfolder.winddwarf.pasneeded small modification, regarding overloadedMin()function. I included modifiedwinddwarf.pasin this distribution, so you can either include modifiedwinddwarf.pas,winddwarfconst.pasandwindsymbols.pasinto your project or you can modify the original source code. In that case, you need onlyfb_embedded2.pasand resource file to be included in your project.The change to be done in
winddwarf.pasis the following:the for cycle in line 2511
for n := 1 to Min(80, count) do
must be changed to
for n := 1 to Min(80, LongInt(count)) do
Installation and usage
editNo installation is required. Just copy the content of this folder into your project directory and include fb_embedded2.pas and, optionally, other .pas and .pp files from this folder into your application.
You can check paths in FB_Embedded.rc. If you change paths, recreate FB_Embedded.res
by double clicking the fb_embedded.bat. Then recompile your application.
The Firebird embedded server will be included in your .exe, without need for external DLLs.
The good thing is that your data-access components will work with embedded database, without change. For example, I use Zeoslib. Compiled .exe works without DLLs distributed.
Since Wine 0.9.60, you can run Windows .exe files compiled with Windows version of Lazarus and fb_embedded.pas. I have tested it on OpenSuse 10.3, Wine 0.9.60. This is an interesting possibility for cross-platform programming.
Contribution
editEverybody is welcome to improve this code. Currently it works only in Windows. I hope somebody will rewrite it to be cross-platform.
See also
edit- Firebird embedded "Regular" Firebird embedded (i.e. not bundled as a resource)