Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-12

Create appending data to existing exe file?

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lee Jenkins

Hi all,

Is it possible to append data to an existing executable file and have that file run correctly? I'm adding scripting features to one of our products and I wanted it so that our software can create a standalone executable for the end user.

My plan was to create the base executable file which had the script engine and business logic to run the script and ship that with the product. Then compile the end user's script and combine it with a copy of the "base executable" to produce the final executable file.

Is this possible or is there a more feasible way of having a program create stand alone executables? Normally, I'd just ship the fpc compiler and just compile the final exe behind the scenes but I don't want to make the source code to the "base" exe available.

Thanks for suggestions or links.

Warm Regards, Lee

Reply by email

Lee Jenkins
to Tomas Hajny: First of all, this may be different for different platforms, so it's probably rather…
Tomas Hajny wrote 16 lines
On 13 Dec 08, at 10:40, Lee Jenkins wrote: > Is it possible to append data to an existing executable file and have that file > run correctly? I'm adding scripting features to one of our products and I > wanted it so that our software can create a standalone executable for the end > user. First of all, this may be different for different platforms, so it's probably rather important to know the platform you're talking about. Executable files for some platforms have explicit support for addition of some data directly into the executable file in the form of the so-called resources and the tool necessary for adding the data (resource compiler) may be directly shipped together with the particular platform, in other cases appending the data outside the real executable image may be more tricky (but it can be probably done for all platforms in this or that way).

Windows 2K/XP/Vista, Linux GTK2 and possible MacOS when/if cocoa is finished.

Show quoted text 18 lines
> My plan was to create the base executable file which had the script engine and > business logic to run the script and ship that with the product. Then compile > the end user's script and combine it with a copy of the "base executable" to > produce the final executable file. > > Is this possible or is there a more feasible way of having a program create > stand alone executables? Normally, I'd just ship the fpc compiler and just > compile the final exe behind the scenes but I don't want to make the source code > to the "base" exe available. Well, if you consider distributing FPC and compiling the final exe "behind the scenes", an alternative may be distributing your base executable in the form of units compiled with the particular FPC version (i.e. without having to distribute source files) and then create and compile just the program skeleton (calling functionality from the pre-compiled units) plus your script.

That is a good idea. Precompiled units would obfuscate main code. I'll give that a try.

Thank you,

Warm Regards, Lee

Reply by email

Tomas Hajny
to Lee Jenkins: Is it possible to append data to an existing executable file and have that file run…

On 13 Dec 08, at 10:40, Lee Jenkins wrote:

Hi Lee,

Is it possible to append data to an existing executable file and have that file run correctly? I'm adding scripting features to one of our products and I wanted it so that our software can create a standalone executable for the end user.

First of all, this may be different for different platforms, so it's probably rather important to know the platform you're talking about. Executable files for some platforms have explicit support for addition of some data directly into the executable file in the form of the so-called resources and the tool necessary for adding the data (resource compiler) may be directly shipped together with the particular platform, in other cases appending the data outside the real executable image may be more tricky (but it can be probably done for all platforms in this or that way).

Show quoted text 9 lines
My plan was to create the base executable file which had the script engine and business logic to run the script and ship that with the product. Then compile the end user's script and combine it with a copy of the "base executable" to produce the final executable file. Is this possible or is there a more feasible way of having a program create stand alone executables? Normally, I'd just ship the fpc compiler and just compile the final exe behind the scenes but I don't want to make the source code to the "base" exe available.

Well, if you consider distributing FPC and compiling the final exe "behind the scenes", an alternative may be distributing your base executable in the form of units compiled with the particular FPC version (i.e. without having to distribute source files) and then create and compile just the program skeleton (calling functionality from the pre-compiled units) plus your script.

Tomas

Reply by email

Jonas Maebe
to Lee Jenkins: Windows 2K/XP/Vista, Linux GTK2 and possible MacOS when/if cocoa is finished. That is a…
Lee Jenkins wrote 18 lines
Tomas Hajny wrote: > On 13 Dec 08, at 10:40, Lee Jenkins wrote: >> Is it possible to append data to an existing executable file and >> have that file run correctly? I'm adding scripting features to >> one of our products and I wanted it so that our software can >> create a standalone executable for the end user. > First of all, this may be different for different platforms, so > it's probably rather important to know the platform you're talking > about. Executable files for some platforms have explicit support > for addition of some data directly into the executable file in the > form of the so-called resources and the tool necessary for adding > the data (resource compiler) may be directly shipped together with > the particular platform, in other cases appending the data outside > the real executable image may be more tricky (but it can be > probably done for all platforms in this or that way). Windows 2K/XP/Vista, Linux GTK2 and possible MacOS when/if cocoa is finished.

At least on Mac OS X, you should not modify the executable but simply include the script as a separate file in the application bundle.

Jonas

Reply by email