SET-SIZE statement

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 for a MEMPTR, and deallocating memory associated with a MEMPTR variable.

Note: Does not apply to SpeedScript programming.

Syntax

SET-SIZE ( memptr-var ) = size
memptr-var
A reference to a variable defined as MEMPTR.
size
An integer expression that specifies the allocated byte size of the region pointed to by memptr-var.

Example

In the following example, the SET-SIZE statement allocates 8 bytes of memory, associates the memory with the ElipRegion variable, and then initializes the region with four SHORT (2-byte) values:

r-setsiz.p

DEFINE VARIABLE ElipRegion AS MEMPTR NO-UNDO.

ASSIGN
 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

See also

GET-POINTER-VALUE function, GET-SIZE function