Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Shared Library and DLL Support : Passing parameters to a shared library routine : Passing the Unknown value and NULL values
 
Passing the Unknown value and NULL values
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.