Passing the Unknown value and NULL values
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
If you have to pass a NULL value to
a shared library routine, do not pass a null MEMPTR variable.
Instead, define the INPUT or INPUT-OUTPUT parameter
as a LONG (32-bit platforms) or INT64 (64-bit
platforms), and pass it a zero value (0) when you run the routine.
If this conflicts with calling the shared library entry point another
way, you can create a second declaration using the ORDINAL option
of the PROCEDURE statement. (Note that this option
is not available on UNIX.)
Using this technique does not conform to best practices with
respect to portability because you must know whether the platform
is 32-bit or 64-bit in order to declare the entry point correctly
(that is, with a LONG or INT64)
and to call it correctly. However, since using DLLs is also not
considered best practice for portability, using this technique is
a less serious compromise to the goal of platform-independence for
applications.
One exception to the rule of not passing a null MEMPTR variable
is a MEMPTR array, in which you can pass a MEMPTR of
size 0.
You cannot pass the Unknown value (?), regardless of the parameter's
data type.