- 4.67.2.36. -
Table of Contents
4. Standard Units
4.67. System - Built-in routines
4.67.2. System Unit Procedures and Functions
4.67.2.36. GetMem procedure
4.67.2.36. GetMem procedure
Targets: MS-DOS, OS/2, Win32
System Unit
Creates a dynamic variable of the specified size and
puts the address of the block in a pointer variable.
Declaration:
procedure GetMem(var P: Pointer; Size: Longint);
Remarks:
To reference the new variable, use P^. If GetMem
finds that there is an insufficient amount of free heap,
a runtime error is generated.
Example:
{$ifndef __CON__}
This program must be compiled as console application only
{ $endif}
uses Crt;
var
ScrnImage : Pointer;
Size : Longint;
begin
Size := SaveScreenSize(10, 10, 20, 20);
GetMem(ScrnImage, Size);
if ScrnImage = nil then Halt(1);
SaveScreen(10,1 0, 20, 20, ScrnImage^);
ClrScr;
...
end.
See also:
FreeMem
- 4.67.2.36. -