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 : Options for dynamic access to a shared library routine
 
Options for dynamic access to a shared library routine
If the PERSISTENT attribute is specified, the entire shared library remains loaded until ABL exits, or until you explicitly unload the shared library by using the ABL RELEASE EXTERNAL statement. For example:
hCall:PERSISTENT = TRUE.
Use the LIBRARY attribute to specify the shared library name. For example:
hCall:LIBRARY = "kernel32.dll".
You can use the LIBRARY-CALLING-CONVENTION attribute to specify how you want the shared library to be called. The following character strings are valid LIBRARY-CALLING-CONVENTION values:
*"CDECL" — Use the C calling convention
*"STDCALL" — Use the standard Windows calling convention
If a value is not specified, LIBRARY-CALLING-CONVENTION defaults to "STDCALL". For example:
hCall:LIBRARY-CALLING-CONVENTION = "CDECL".
The optional ORDINAL attribute specifies the number of the DLL entry point to invoke. For UNIX shared libraries this attribute does not apply and is ignored if specified. For example:
hCall:ORDINAL = 2.
Use the optional SET-PARAMETER( ) method to define the parameter values, one at a time, to be passed to the shared library routine. This is the syntax for the SET-PARAMETER( ) method:

Syntax

SET-PARAMETER(parameter-number, data-type, iomode, parameter-value)
parameter-number
An INTEGER expression indicating the order of the parameter. Use 1 for the first parameter, 2 for the second parameter, and so on.
data-type
A CHARACTER expression indicating the data type of the parameter. For each parameter, the data type specified by the caller and the callee must be compatible.
When invoking a Windows DLL or a UNIX shared library function, ABL DLL data types are valid as data-type values. data-type specifies the type expected by the DLL or the shared library routine parameter. For example, the parameter data-type is set to "LONG" if the DLL routine parameter expects "LONG". For a list of valid ABL DLL data types, see OpenEdge Development: ABL Reference.
iomode
A CHARACTER expression indicating the mode of the parameter.
parameter-value
An expression whose type is compatible with data-type. The parameter-value argument can represent a determinate or indeterminate array. For more information about compatibility of shared library routine and ABL parameter data types, see Table 54.
In the following example, the NUM-PARAMETERS attribute is set to the number of parameters that the shared library routine expects, followed by a SET-PARAMETER( ) method call for each parameter:
hCall:NUM-PARAMETERS = 2.
hCall:SET-PARAMETER( 1, "LONG", "INPUT", msecs).
hCall:SET-PARAMETER( 2, "INTEGER", "INPUT", 5000).