Recent

Author Topic: $SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE  (Read 1343 times)

440bx

  • Hero Member
  • *****
  • Posts: 2625
$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE
« on: November 21, 2021, 02:28:03 am »
Hello,

I figured I'd try the "$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE" in a program but the compiler isn't liking it.

With FPC v3.0.4, I get the error:
Code: Text  [Select][+][-]
  1. Error: Identifier not found "IMAGE_FILE_LARGE_ADDRESS_AWARE"

With FPC v3.2.2, I get the error:
Code: Text  [Select][+][-]
  1. Error: Compile time expression: Wanted Integer but got AnsiString at SETPEFLAGS

What's the magic incantation to make that option work ? :)

Thank you for your help.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

loaded

  • Sr. Member
  • ****
  • Posts: 441
Re: $SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE
« Reply #1 on: November 21, 2021, 07:33:31 am »
Hi
This is how I work.
Code: Pascal  [Select][+][-]
  1. {$SetPeFlags $0020}
By the way, I want to talk about an interesting situation.
It works when Code is first added to the unit. Then if the unit is recompiled without any changes, it doesn't work.
If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

josh

  • Hero Member
  • *****
  • Posts: 858
Re: $SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE
« Reply #2 on: November 21, 2021, 07:41:17 am »
the constant IMAGE_FILE_LARGE_ADDRESS_AWARE is defined in defines.inc, which is part of the windows unit.
so add the windows unit to your uses clause, then set the flag after the uses , should work fine.

uses windows, ........

{$SetPeFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

440bx

  • Hero Member
  • *****
  • Posts: 2625
Re: $SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE
« Reply #3 on: November 21, 2021, 08:15:55 am »
Thank you loaded and Josh.

I didn't think about the fact that the directive must appear _after_ the Windows unit. 

Thank both again, that was very helpful.

FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 3656
  • Compiler Developer
Re: $SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE
« Reply #4 on: November 21, 2021, 01:32:22 pm »
I didn't think about the fact that the directive must appear _after_ the Windows unit. 

I should have mentioned that in the other thread, but the directives $SetPEFlags and $SetPEOptFlags either take an integer value, an integer constant identifier (3.0.x) or an integer constant expression (which in turn can contain constant values or identifiers) (3.2+). And the identifiers need to be in scope of course. ;)

 

TinyPortal © 2005-2018