[fpc-pascal] Calling function pointer to main program
Ryan Joseph
genericptr at gmail.com
Fri Jan 3 18:33:58 CET 2020
> On Jan 2, 2020, at 2:57 PM, Ryan Joseph <genericptr at gmail.com> 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 provide an example? When ever I try to use it I get linker errors.
I've basically just started with a trimmed down program that does nothing but define an external new main function (like SDL does). From the SDL sources I thought that it would now point to the main program body but I can't get past linker errors.
fpc main.pas -XMuser_main
Undefined symbols for architecture x86_64:
"_P$TEST_$$_USER_MAIN$LONGINT$PCHAR$$LONGINT", referenced from:
_PASCALMAIN in main.o
"_main", referenced from:
start in crt1.10.5.o
(maybe you meant: _user_main)
program test;
uses
ctypes;
function user_main(argc: cint; argv: pchar): cint; external;
begin
user_main(0,'');
end.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list