Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi 2007 IMAGE_FILE_LARGE_ADDRESS_AWARE

I want my application to be able to use more than 2GB memory, I googled around and found that the IMAGE_FILE_LARGE_ADDRESS_AWARE command lets me do that.

So I added

{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}

To my program's .dpr file, after all the uses and the {$R *.res} line,

but when I compile, I get the error:

E2003 Undeclared identifier: 'IMAGE_FILE_LARGE_ADDRESS_AWARE'

What am I doing wrong?

Also, on Windows 7 64bit, do I need to mess around with boot settings for this command to work, or just compile a 32bit application with the command and it will do everything else automatically?

Thanks

like image 409
KingOfKong Avatar asked Oct 19 '11 14:10

KingOfKong


2 Answers

The answer to the actual question is to add to uses the unit Windows.

like image 192
Trinidad Avatar answered Oct 31 '22 11:10

Trinidad


Also, on Windows 7 64bit, do I need to mess around with boot settings for this command to work, or just compile a 32bit application with the command and it will do everything else automatically?

64-bit Windows will provide 4 GB address space automatically, without boot tweaks.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb613473%28v=vs.85%29.aspx:

To enable an application to use the larger address space, set the IMAGE_FILE_LARGE_ADDRESS_AWARE flag in the image header. The linker included with Microsoft Visual C++ supports the /LARGEADDRESSAWARE switch to set this flag. Setting this flag and then running the application on a system that does not have 4GT support should not affect the application.

On 64-bit editions of Windows, 32-bit applications marked with the IMAGE_FILE_LARGE_ADDRESS_AWARE flag have 4 GB of address space available.

like image 29
Roman R. Avatar answered Oct 31 '22 09:10

Roman R.