mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-21 01:49:08 +02:00
* the 'main' procedure for darwin is now placed in the main program instead
of in the system unit + ability to rename this 'main' symbol (-XM<x>, e.g. -XMSDL_main for SDL), for all OS'es + mention the -Xm parameter in the help git-svn-id: trunk@503 -
This commit is contained in:
parent
e53f6d02f1
commit
9d9fd923d9
@ -288,6 +288,10 @@ interface
|
|||||||
syscall_convention : string = 'LEGACY';
|
syscall_convention : string = 'LEGACY';
|
||||||
{$endif powerpc}
|
{$endif powerpc}
|
||||||
|
|
||||||
|
{ default name of the C-style "main" procedure of the library/program }
|
||||||
|
{ (this will be prefixed with the target_info.cprefix) }
|
||||||
|
mainaliasname : string = 'main';
|
||||||
|
|
||||||
procedure abstract;
|
procedure abstract;
|
||||||
|
|
||||||
function bstoslash(const s : string) : string;
|
function bstoslash(const s : string) : string;
|
||||||
|
@ -1223,6 +1223,11 @@ begin
|
|||||||
exclude(initglobalswitches,cs_link_shared);
|
exclude(initglobalswitches,cs_link_shared);
|
||||||
LinkTypeSetExplicitly:=true;
|
LinkTypeSetExplicitly:=true;
|
||||||
end;
|
end;
|
||||||
|
'M' :
|
||||||
|
begin
|
||||||
|
mainaliasname:=Copy(more,2,length(More)-1);
|
||||||
|
More:='';
|
||||||
|
end;
|
||||||
'-' :
|
'-' :
|
||||||
begin
|
begin
|
||||||
exclude(initglobalswitches,cs_link_staticflag);
|
exclude(initglobalswitches,cs_link_staticflag);
|
||||||
@ -1784,6 +1789,8 @@ begin
|
|||||||
def_system_macro('VER'+version_nr+'_'+release_nr+'_'+patch_nr);
|
def_system_macro('VER'+version_nr+'_'+release_nr+'_'+patch_nr);
|
||||||
|
|
||||||
{ Temporary defines, until things settle down }
|
{ Temporary defines, until things settle down }
|
||||||
|
{ "main" symbol is generated in the main program, and left out of the system unit }
|
||||||
|
def_system_macro('FPC_DARWIN_PASCALMAIN');
|
||||||
if pocall_default = pocall_register then
|
if pocall_default = pocall_register then
|
||||||
def_system_macro('REGCALL');
|
def_system_macro('REGCALL');
|
||||||
|
|
||||||
|
@ -1447,26 +1447,24 @@ implementation
|
|||||||
|
|
||||||
{ The program intialization needs an alias, so it can be called
|
{ The program intialization needs an alias, so it can be called
|
||||||
from the bootstrap code.}
|
from the bootstrap code.}
|
||||||
if islibrary or
|
|
||||||
(target_info.system in [system_powerpc_macos,system_powerpc_darwin]) then
|
if islibrary then
|
||||||
begin
|
begin
|
||||||
pd:=create_main_proc(make_mangledname('',current_module.localsymtable,'main'),potype_proginit,st);
|
pd:=create_main_proc(make_mangledname('',current_module.localsymtable,mainaliasname),potype_proginit,st);
|
||||||
{ Win32 startup code needs a single name }
|
{ Win32 startup code needs a single name }
|
||||||
// if (target_info.system in [system_i386_win32,system_i386_wdosx]) then
|
// if (target_info.system in [system_i386_win32,system_i386_wdosx]) then
|
||||||
pd.aliasnames.insert('PASCALMAIN');
|
pd.aliasnames.insert('PASCALMAIN');
|
||||||
end
|
end
|
||||||
else
|
else if (target_info.system = system_i386_netware) or
|
||||||
begin
|
(target_info.system = system_i386_netwlibc) then
|
||||||
if (target_info.system = system_i386_netware) or
|
begin
|
||||||
(target_info.system = system_i386_netwlibc) then
|
pd:=create_main_proc('PASCALMAIN',potype_proginit,st); { main is need by the netware rtl }
|
||||||
begin
|
end
|
||||||
pd:=create_main_proc('PASCALMAIN',potype_proginit,st); { main is need by the netware rtl }
|
else
|
||||||
end else
|
begin
|
||||||
begin
|
pd:=create_main_proc(mainaliasname,potype_proginit,st);
|
||||||
pd:=create_main_proc('main',potype_proginit,st);
|
pd.aliasnames.insert('PASCALMAIN');
|
||||||
pd.aliasnames.insert('PASCALMAIN');
|
end;
|
||||||
end;
|
|
||||||
end;
|
|
||||||
tcgprocinfo(current_procinfo).parse_body;
|
tcgprocinfo(current_procinfo).parse_body;
|
||||||
tcgprocinfo(current_procinfo).generate_code;
|
tcgprocinfo(current_procinfo).generate_code;
|
||||||
tcgprocinfo(current_procinfo).resetprocdef;
|
tcgprocinfo(current_procinfo).resetprocdef;
|
||||||
|
@ -216,16 +216,23 @@ end;
|
|||||||
{ can also be used with other BSD's if they use the system's crtX instead of prtX }
|
{ can also be used with other BSD's if they use the system's crtX instead of prtX }
|
||||||
|
|
||||||
{$ifdef Darwin}
|
{$ifdef Darwin}
|
||||||
|
|
||||||
|
{$ifndef FPC_DARWIN_PASCALMAIN}
|
||||||
procedure pascalmain; external name 'PASCALMAIN';
|
procedure pascalmain; external name 'PASCALMAIN';
|
||||||
|
|
||||||
{ Main entry point in C style, needed to capture program parameters. }
|
{ Main entry point in C style, needed to capture program parameters. }
|
||||||
procedure main(argcparam: Longint; argvparam: ppchar; envpparam: ppchar); cdecl; [public];
|
procedure main(argcparam: Longint; argvparam: ppchar; envpparam: ppchar); cdecl; [public];
|
||||||
|
{$else FPC_DARWIN_PASCALMAIN}
|
||||||
|
procedure FPC_SYSTEMMAIN(argcparam: Longint; argvparam: ppchar; envpparam: ppchar); cdecl; [public];
|
||||||
|
{$endif FPC_DARWIN_PASCALMAIN}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
argc:= argcparam;
|
argc:= argcparam;
|
||||||
argv:= argvparam;
|
argv:= argvparam;
|
||||||
envp:= envpparam;
|
envp:= envpparam;
|
||||||
|
{$ifndef FPC_DARWIN_PASCALMAIN}
|
||||||
pascalmain; {run the pascal main program}
|
pascalmain; {run the pascal main program}
|
||||||
|
{$endif FPC_DARWIN_PASCALMAIN}
|
||||||
end;
|
end;
|
||||||
{$endif Darwin}
|
{$endif Darwin}
|
||||||
{$endif FPC_USE_LIBC}
|
{$endif FPC_USE_LIBC}
|
||||||
|
Loading…
Reference in New Issue
Block a user