SET-POINTER-VALUE statement

Sets a variable of type MEMPTR to the value of a particular memory location.

Note: Does not apply to SpeedScript programming.

Syntax

SET-POINTER-VALUE ( memptr-var ) = memptr-value
memptr-var
A reference to a variable defined as MEMPTR.
memptr-value
An integer that represents a memory location.

Example

The following example calls a DLL routine that returns a pointer to a structure, extracts an address at byte 5 of the structure, uses SET-POINTER-VALUE to assign the address to an ABL MEMPTR, and displays the character string at the address:

DEFINE VARIABLE person_struct AS MEMPTR NO-UNDO. /* pointer to structure */
DEFINE VARIABLE name          AS MEMPTR NO-UNDO. /* pointer to name */

SET-SIZE(person_struct) = 8.

RUN person_info (OUTPUT person_struct).
SET-POINTER-VALUE(name) = GET-LONG(person_struct,5).
DISPLAY GET-STRING(name,1) FORMAT "x(50)".
SET-SIZE(person_struct) = 0.

PROCEDURE person_info EXTERNAL "person.dll" PERSISTENT:
  DEFINE OUTPUT PARAMETER person_struct AS MEMPTR.
END PROCEDURE.

Notes

See also

GET-POINTER-VALUE function, SET-SIZE statement