Initializing and uninitializing MEMPTR variables
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Typically when you initialize a MEMPTR variable,
you use the SET-SIZE statement to allocate a region
of memory for a specified size and associate it with the variable.
You can also use a shared library routine to allocate the memory
for a MEMPTR variable by passing the variable appropriately
as a RETURN parameter to the routine. Then, to
complete MEMPTR initialization, you should use
the SET-SIZE statement so that ABL knows how big
the memory area is.
You must know the exact size of data returned by the shared library
routine to initialize the MEMPTR variable properly with
the SET-SIZE statement. If you use an incorrect value,
you might not be able to access the data as you expect. Note also
that if you do not complete initialization of a shared library pre-initialized MEMPTR variable
using the SET-SIZE statement, ABL does not perform
any bounds checking when you read or modify contents of the structure.