Progress
Language Reference


SET-SIZE Statement

Interfaces
OS
SpeedScript
All
All
No

Manages memory associated with a MEMPTR variable. This includes allocating and associating a region of memory with an uninitialized MEMPTR variable, setting the size of a region allocated with a Windows dynamic link library (DLL) or UNIX shared library routine, and deallocating memory associated with an MEMPTR variable.

SYNTAX

SET-SIZE ( memptr-var ) = size 

memptr-var

A reference to a variable defined as MEMPTR.

size

An integer expression that specifies the size of the region pointed to by memptr-var.

EXAMPLE

This example, the SET-SIZE statement allocates 8 bytes of memory and associates it with ElipRegion. It then initializes the region with four SHORT (2-byte) values.

r-setsiz.p
DEFINE VARIABLE ElipRegion AS MEMPTR.

SET-SIZE(ElipRegion) = 8.
PUT-SHORT(ElipRegion, 1) = 10.
PUT-SHORT(ElipRegion, 3) = 10.
PUT-SHORT(ElipRegion, 5) = 200.
PUT-SHORT(ElipRegion, 7) = 50. 

NOTES

CAUTION: You must know and specify the exact size of the memory region returned by the DLL routine from the type of structure it allocates. An incorrect size can result in data loss.

SEE ALSO

GET-POINTER-VALUE Function, GET-SIZE Function


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095