Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Introduction to External Program Interfaces : Using MEMPTR to reference external data : Initializing and uninitializing MEMPTR variables : Initializing MEMPTR variables using the SET-SIZE statement
 
Initializing MEMPTR variables using the SET-SIZE statement
This is the syntax for the SET-SIZE statement:

Syntax

SET-SIZE ( mptr-name ) = expression
The value mptr-name is the name of a MEMPTR variable, and expression is an integer expression specifying the size, in bytes, of a memory region associated with mptr-name. The value of expression can also be zero (0), which frees any memory previously allocated to mptr-name. ABL uses this size to perform bounds checking that ensures you do not read or write to portions of memory outside of the specified region.
If mptr-name is uninitialized (that is, defined but not associated with any memory region) and expression is greater than zero (0), the SET-SIZE statement allocates a memory region whose size is specified by expression, and associates it with mptr-name. If mptr-name is already initialized and expression is greater than zero (0), the SET-SIZE statement has no effect.
To resize memory allocated to a MEMPTR variable, you must invoke SET-SIZE with an expression of zero (0), then invoke SET-SIZE with an expression equal to the new allocation.