Hello,
I am not familiar with the GPC, but i will have to rewrite a Java-application, which calls a Pascal-compiler and executes the new-built program afterwords to work with GPC instead of Turbo-Pascal.
So I have two questions, for which I request Your help:
1. There is a really big difference in the size of executables made by TPC under Dos ans those made by GPC under LINUX. Is this normal, or is there any possibility, to decrease the size of the executables made by GPC?
2. Is there any possibility, to give the Sourcecode to GPC as a string-parameter instead of using a file? I would like to call GPC from the Java-Program this way, if possible.
Greetings, Michael Paap
michael paap wrote:
- There is a really big difference in the size of executables made by
TPC under Dos ans those made by GPC under LINUX. Is this normal, or is there any possibility, to decrease the size of the executables made by GPC?
You might want to strip the binary after the compilation, or compile without `-g' and with `-s'. Last thing, which makes a big difference, is the RTS being built as a static library. You might think of building the RTS as a shared library, but I don't suggest that.
Regards,
Nick
michael paap wrote:
- There is a really big difference in the size of executables made by
TPC under Dos ans those made by GPC under LINUX. Is this normal, or is there any possibility, to decrease the size of the executables made by GPC?
You might want to strip the binary after the compilation, or compile without `-g' and with `-s'. Last thing, which makes a big difference, is the RTS being built as a static library. You might think of building the RTS as a shared library, but I don't suggest that.
Does creating a static library force smart linking (eliminating unused code?)
Marco van de Voort wrote:
michael paap wrote:
- There is a really big difference in the size of executables made by
TPC under Dos ans those made by GPC under LINUX. Is this normal, or is there any possibility, to decrease the size of the executables made by GPC?
You might want to strip the binary after the compilation, or compile without `-g' and with `-s'. Last thing, which makes a big difference, is the RTS being built as a static library. You might think of building the RTS as a shared library, but I don't suggest that.
Does creating a static library force smart linking (eliminating unused code?)
Only on a per-object-file level. There are plans to let GPC automatically split a source file into multiple object files (one per routine, basically) to facilitate real smart linking.
Frank
michael paap wrote:
- Is there any possibility, to give the Sourcecode to GPC as a
string-parameter instead of using a file? I would like to call GPC from the Java-Program this way, if possible.
Nope, GPC cannot read the source code from an argument. If you really need to invoke it like this, I suggest a little shell script like this (very roughly):
... handle other options TMPFILE=... echo "$..." > "$TMPFILE" gpc ... "$TMPFILE"
(You might want to take the usual precautions WRT temp files in shell scripts.)
Frank