Skip to content

Commit 42b0015

Browse files
committed
fix delphi posix compilation
1 parent 29f3ad9 commit 42b0015

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

HashLib/src/Include/HashLib.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
{$MESSAGE ERROR 'This Library requires Delphi 2010 or higher.'}
2222
{$IFEND}
2323

24+
// Silence H2586 (legacy $IFEND) on XE4+ where $ENDIF can also close $IF.
25+
// The $LEGACYIFEND directive itself was introduced in XE4 (25.0), so the
26+
// guard is necessary to keep Delphi 2010 / XE / XE2 / XE3 compiling.
27+
{$IF CompilerVersion >= 25.0}
28+
{$LEGACYIFEND ON}
29+
{$IFEND}
30+
2431
{$DEFINE DELPHI}
2532

2633
{$DEFINITIONINFO ON} // Enable code browsing (Ctrl+Click)

HashLib/src/Utils/HlpArmHwCapProvider.pas

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,17 @@ implementation
139139

140140
class procedure TArmHwCapProvider.ResolveDynamicImports();
141141
var
142-
LHandle: Pointer;
142+
LHandle: NativeUInt;
143143
begin
144144
FGetAuxVal := nil;
145145

146+
{$IFDEF FPC}
147+
LHandle := NativeUInt(dlopen(nil, RTLD_NOW));
148+
{$ELSE}
146149
LHandle := dlopen(nil, RTLD_NOW);
147-
if LHandle = nil then
150+
{$ENDIF}
151+
152+
if LHandle = 0 then
148153
Exit;
149154

150155
try
@@ -179,12 +184,17 @@ class function TArmHwCapProvider.GetHwCap2(): UInt64;
179184

180185
class procedure TArmHwCapProvider.ResolveDynamicImports();
181186
var
182-
LHandle: Pointer;
187+
LHandle: NativeUInt;
183188
begin
184189
FElfAuxInfo := nil;
185190

191+
{$IFDEF FPC}
192+
LHandle := NativeUInt(dlopen(nil, RTLD_NOW));
193+
{$ELSE}
186194
LHandle := dlopen(nil, RTLD_NOW);
187-
if LHandle = nil then
195+
{$ENDIF}
196+
197+
if LHandle = 0 then
188198
Exit;
189199

190200
try

0 commit comments

Comments
 (0)