fpc/rtl/darwin/sysinit.pas
svenbarth ca07a4f86f Merged revision(s) 32491-32492 from branches/svenbarth/packages:
Adjust non-Windows resources to work with indirect main information as well.

rtl/inc/systemh.inc, TEntryInformation:
  + new cross platform field ResLocation which stores the pointer to the resources
rtl/inc/intres.inc:
  * change the type of ResHeader from PResHdr to PPResHdr (and adjust code that uses it accordingly; Note: the first dereferencing is assumed to be always valid!)
  * adjust declaration of ResHeader depending on whether indirect main information is used or not
rtl/darwin/sysinit.pas & rtl/linux/si_impl.inc:
  * pass the location of the resources through SysInitEntryInformation
rtl/bsd/system.pp & rtl/linux/system.pp:
  + new public variable FPCResLocation which is setup by SysEntry
rtl/win32/sysinit.inc:
  * initialize ResLocation of SysInitEntryInformation as Nil
rtl/win32/system.pp:
  * initialize ResLocation of EntryInformation as Nil
........
For systems that support both internal and external resources (in this case only Darwin ones) we need to generate the FPC_RESLOCATION symbol always, because the SysInit unit is resource type agnostic.

ngenutil.pas, tnodeutils:
  * InsertResourceInfo: generate FPC_RESLOCATION symbol pointing to 0 in case the program is compiled on Darwin with resources set to external ones (-We)

git-svn-id: trunk@33952 -
2016-06-12 09:08:17 +00:00

77 lines
2.3 KiB
ObjectPascal

{
This file is part of the Free Pascal run time library.
Copyright (c) 1999-2000 by the Free Pascal development team
Implements indirect entry point for executables and libaries
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
unit sysinit;
interface
implementation
procedure PascalMain; external name '_PASCALMAIN';
procedure SysEntry(constref info: TEntryInformation); external name 'FPC_SysEntry';
var
InitFinalTable : record end; external name 'INITFINAL';
ThreadvarTablesTable : record end; external name 'FPC_THREADVARTABLES';
{$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
WideInitTables : record end; external name 'FPC_WIDEINITTABLES';
{$endif}
{$ifdef FPC_HAS_RESSTRINITS}
ResStrInitTables : record end; external name 'FPC_RESSTRINITTABLES';
{$endif}
ResLocation: record end; external name 'FPC_RESLOCATION';
ResourceStringTables : record end; external name 'FPC_RESOURCESTRINGTABLES';
StkLen: SizeUInt; external name '__stklen';
const
SysInitEntryInformation : TEntryInformation = (
InitFinalTable : @InitFinalTable;
ThreadvarTablesTable : @ThreadvarTablesTable;
ResourceStringTables : @ResourceStringTables;
{$ifdef FPC_HAS_RESSTRINITS}
ResStrInitTables : @ResStrInitTables;
{$else}
ResStrInitTables : nil;
{$endif}
{$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
WideInitTables : @WideInitTables;
{$endif}
ResLocation : @ResLocation;
PascalMain : @PascalMain;
valgrind_used : false;
OS: (
argc: 0;
argv: nil;
envp: nil;
stklen: 0;
);
);
procedure FPC_SYSTEMMAIN(argcparam: Longint; argvparam: ppchar; envpparam: ppchar); cdecl; [public];
begin
SysInitEntryInformation.OS.argc := argcparam;
SysInitEntryInformation.OS.argv := argvparam;
SysInitEntryInformation.OS.envp := envpparam;
SysInitEntryInformation.OS.stklen := StkLen;
SysEntry(SysInitEntryInformation);
end;
procedure FPC_LIBMAIN; cdecl; [public];
begin
SysEntry(SysInitEntryInformation);
end;
end.