7
votes

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

2
add uses WindowsPremature Optimization

2 Answers

5
votes

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.

7
votes

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