Re: [fpc-pascal] Calling function pointer to main program

2020-01-03 Thread Ryan Joseph via fpc-pascal
> On Jan 3, 2020, at 12:29 PM, Jonas Maebe wrote: > > So add 'cdecl; public;" to its declaration and definition. Nice the demo program compiles now. Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://li

Re: [fpc-pascal] Calling function pointer to main program

2020-01-03 Thread Jonas Maebe
On 03/01/2020 20:19, Ryan Joseph via fpc-pascal wrote: >> On Jan 3, 2020, at 11:35 AM, Jonas Maebe wrote: >> >> Additionally, you will also have to link in an object/library that does >> define a regular "main" function. And note that this will only work on >> libc-based targets (afaik only Darwin

Re: [fpc-pascal] Calling function pointer to main program

2020-01-03 Thread Ryan Joseph via fpc-pascal
> On Jan 3, 2020, at 11:35 AM, Jonas Maebe wrote: > > Additionally, you will also have to link in an object/library that does > define a regular "main" function. And note that this will only work on > libc-based targets (afaik only Darwin, Solaris, and AIX at this point). So there needs to be

Re: [fpc-pascal] Calling function pointer to main program

2020-01-03 Thread Jonas Maebe
On 03/01/2020 18:33, Ryan Joseph via fpc-pascal wrote: >> On Jan 2, 2020, at 2:57 PM, Ryan Joseph wrote: >> >> extern C_LINKAGE int SDL_main(int argc, char *argv[]); >> >> which they call from within the iOS event loop and that calls the programs >> main functions which was defined using -XMSDL_m

Re: [fpc-pascal] Calling function pointer to main program

2020-01-03 Thread Ryan Joseph via fpc-pascal
> On Jan 2, 2020, at 2:57 PM, Ryan Joseph wrote: > > extern C_LINKAGE int SDL_main(int argc, char *argv[]); > > which they call from within the iOS event loop and that calls the programs > main functions which was defined using -XMSDL_main I still can't figure out how -XM works. Can anyone p

Re: [fpc-pascal] Calling function pointer to main program

2020-01-02 Thread Ryan Joseph via fpc-pascal
> On Jan 2, 2020, at 2:51 PM, Sven Barth via fpc-pascal > wrote: > > What exactly are you trying to accomplish on which platform with which > version? > I'm making an iOS platform layer in the style of SDL which needs to use iOS's main loop which never returns until the program stops exec

Re: [fpc-pascal] Calling function pointer to main program

2020-01-02 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Do., 2. Jan. 2020, 18:11: > I need to override the main program function and then call back the main > program later. 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? > What ex

Re: [fpc-pascal] Calling function pointer to main program

2020-01-02 Thread leledumbo via fpc-pascal
> 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,@fun

[fpc-pascal] Calling function pointer to main program

2020-01-02 Thread Ryan Joseph via fpc-pascal
I need to override the main program function and then call back the main program later. 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? Regards, Ryan Joseph ___ f