[fpc-pascal] Re: creating a standalone executable (eg: application installation file)

Milan Marusinec milan at marusinec.sk
Tue Jan 12 14:10:36 CET 2010


Graeme Geldenhuys wrote:
> * How does one create such a standalone application?
> * How do you include the application executable and other resources
> (text, image, sound files etc) inside such an installation executable?

Hello Graeme,

I did this on Windows in Delphi, but the principle is pretty
the same for linux app.

1. Create your own file structure archive format or
    pack all installation files inside one .zip
    (later you should be able to extract files in
     memory from that .zip or own format file).

2. Use bin2obj.exe utility, to convert that .zip (or own)
    archive file into the pascal source code "Const statement".
    (eg. Const inst_arch : Array[0..xx] of byte = (0,1,2,...);).

3. Embed converted inst_arch constant into your app source code.
    (If you use is as {$I my_istall_file.inc}, you can rebuild
     installation data file from outside the installer app src code).

4. On RunTime, map inst_arch (you know its size) to TStream
    and use it as the source memory file with all your installation
    stuff inside (text, image, sound files etc).

The whole installer is in fact just an ordinary app with embedded
data block through const statement.

If you want to see this kind of installer (on windows),
have a look at: http://www.crossgl.com/CrossGL-SnapDraw-Installer.exe

Milan





More information about the fpc-pascal mailing list