Passing CHARACTER values to shared library routines
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
If you are passing an ABL character string to a shared
library routine, you can pass it as a CHARACTER variable
or expression. However, if you expect the shared library routine
to modify the value, Progress Software Corporation recommends that you pass the ABL
character string in a MEMPTR memory region as a
null-terminated string. This is required if it is an OUTPUT parameter. Otherwise,
the shared library routine might inappropriately modify ABL memory
outside the bounds of the CHARACTER value with unpredictable
results. Assuming ABL has allocated the memory for the string (using SET-SIZE),
you then use the GET-STRING function to extract
the CHARACTER value.
If the DLL allocates the memory as either a RETURN value
or an OUTPUT parameter, you must use an OUTPUT MEMPTR.
For a RETURN parameter, you can use GET-STRING (or
another access function) directly on the MEMPTR on
return. However, for an OUTPUT parameter, you must
use the GET-POINTER-VALUE and SET-POINTER-VALUE functions
to access the data on return. (For more information on the GET- and SET-POINTER-VALUE functions,
see ABL Reference.)