[fpc-pascal] Calling function pointer to main program
leledumbo
leledumbo_cool at yahoo.co.id
Thu Jan 2 22:04:06 CET 2020
> 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, at function
main:
.globl PASCALMAIN
.type PASCALMAIN, at function
PASCALMAIN:
vs when you do (-XMmymain):
.globl mymain
.type mymain, at function
mymain:
.globl PASCALMAIN
.type PASCALMAIN, at 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/
More information about the fpc-pascal
mailing list