[fpc-pascal] Create appending data to existing exe file?
Lee Jenkins
lee at datatrakpos.com
Sun Dec 14 02:54:14 CET 2008
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.
>
>> 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
More information about the fpc-pascal
mailing list