mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 13:39:36 +02:00
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 -
This commit is contained in:
parent
3f45860cf9
commit
ca07a4f86f
@ -1272,11 +1272,14 @@ implementation
|
||||
var
|
||||
tcb: ttai_typedconstbuilder;
|
||||
begin
|
||||
if (target_res.id in [res_elf,res_macho,res_xcoff]) then
|
||||
if (target_res.id in [res_elf,res_macho,res_xcoff]) or
|
||||
{ generate the FPC_RESLOCATION symbol even when using external resources,
|
||||
because in SysInit we can only reference it unconditionally }
|
||||
((target_res.id=res_ext) and (target_info.system in systems_darwin)) then
|
||||
begin
|
||||
tcb:=ctai_typedconstbuilder.create([tcalo_new_section,tcalo_make_dead_strippable]);
|
||||
|
||||
if ResourcesUsed then
|
||||
if ResourcesUsed and (target_res.id<>res_ext) then
|
||||
tcb.emit_tai(Tai_const.Createname('FPC_RESSYMBOL',0),voidpointertype)
|
||||
else
|
||||
{ Nil pointer to resource information }
|
||||
|
@ -30,6 +30,7 @@ var
|
||||
{$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';
|
||||
|
||||
@ -46,7 +47,7 @@ const
|
||||
{$ifndef FPC_WIDESTRING_EQUAL_UNICODESTRING}
|
||||
WideInitTables : @WideInitTables;
|
||||
{$endif}
|
||||
ResLocation : nil;
|
||||
ResLocation : @ResLocation;
|
||||
PascalMain : @PascalMain;
|
||||
valgrind_used : false;
|
||||
OS: (
|
||||
|
@ -28,14 +28,21 @@ type
|
||||
handles : PPtrUint; //pointer to handles
|
||||
end;
|
||||
PResHdr = ^TResHdr;
|
||||
PPResHdr = ^PResHdr;
|
||||
|
||||
TLibGetResHdr=function():PResHdr;
|
||||
|
||||
var
|
||||
{$ifdef FPC_HAS_WINLIKERESOURCES}
|
||||
ResHeader : PResHdr; external name 'FPC_RESLOCATION';
|
||||
{$ifdef FPC_HAS_INDIRECT_ENTRY_INFORMATION}
|
||||
ResHeader : PPResHdr; external name '_FPC_ResLocation';
|
||||
{$else}
|
||||
ResHeader : PResHdr= nil;
|
||||
ResHeaderVar : PResHdr; external name 'FPC_RESLOCATION';
|
||||
ResHeader : PPResHdr = @ResHeaderVar;
|
||||
{$endif}
|
||||
{$else}
|
||||
ResHeaderVar : PResHdr = nil;
|
||||
ResHeader : PPResHdr= @ResHeaderVar;
|
||||
{$endif}
|
||||
|
||||
(*****************************************************************************
|
||||
@ -49,7 +56,7 @@ var
|
||||
begin
|
||||
ExtGetResHdr:=nil;
|
||||
if ModuleHandle=0 then
|
||||
ExtGetResHdr:=ResHeader // internal
|
||||
ExtGetResHdr:=ResHeader^ // internal
|
||||
else
|
||||
begin
|
||||
// 1-st way to get resource location
|
||||
@ -351,18 +358,18 @@ end;
|
||||
Function IntLockResource(ResData: TFPResourceHGLOBAL): Pointer;
|
||||
begin
|
||||
IntLockResource:=Nil;
|
||||
if ResHeader=nil then exit;
|
||||
if ResHeader^=nil then exit;
|
||||
IntLockResource:=Pointer(ResData);
|
||||
end;
|
||||
|
||||
Function IntUnlockResource(ResData: TFPResourceHGLOBAL): LongBool;
|
||||
begin
|
||||
IntUnlockResource:=(ResHeader<>nil);
|
||||
IntUnlockResource:=(ResHeader^<>nil);
|
||||
end;
|
||||
|
||||
Function IntFreeResource(ResData: TFPResourceHGLOBAL): LongBool;
|
||||
begin
|
||||
IntFreeResource:=(ResHeader<>nil);
|
||||
IntFreeResource:=(ResHeader^<>nil);
|
||||
end;
|
||||
|
||||
const
|
||||
|
Loading…
Reference in New Issue
Block a user