> I know I can use -XM to set another function name besides "main" but then
how do I call back the original function "main" later?

I quickly analyze the generated assembly when you don't pass -XM:

.globl  main
        .type   main,@function
main:
.globl  PASCALMAIN
        .type   PASCALMAIN,@function
PASCALMAIN:

vs when you do (-XMmymain):

.globl  mymain
        .type   mymain,@function
mymain:
.globl  PASCALMAIN
        .type   PASCALMAIN,@function
PASCALMAIN:

so basically the original main does nothing and jump straight to PASCALMAIN,
which is always there. So you can make your own main in a separate file that
must be linked in during linking which calls whatever name you pass to -XM.



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to