Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Shared Library and DLL Support : Accessing a shared library entry point : Declaring a shared library for dynamic access
 
Declaring a shared library for dynamic access
To dynamically access a shared library routine from within ABL, first create a call object with the CREATE CALL statement, which stores the handle to the new call object in the specified variable of type HANDLE. To create a call object, use the following syntax:

Syntax

CREATE CALL object-handle [ IN widget-pool ].
For example:
DEFINE VARIABLE hCall AS HANDLE NO-UNDO.

CREATE CALL hCall.
Compared to accessing a shared library statically with the PROCEDURE and DEFINE PARAMETER statements, a shared library is accessed dynamically by setting several call object handle attributes. In the following code fragment, the call object hCall invokes the GetVersion routine in the kernel32.dll shared library:
ASSIGN
  hCall:CALL-NAME             = "GetVersion"
  hCall:LIBRARY               = "kernel32.dll"
  hCall:CALL-TYPE             = DLL-CALL-TYPE
  hCall:RETURN-VALUE-DLL-TYPE = "LONG".
The CALL-TYPE attribute identifies that the routine exists in a shared library. The routine expects the LONG data type, as specified by the RETURN-VALUE-DLL-TYPE attribute.
* Options for dynamic access to a shared library routine