Options for dynamic access to a shared library routine
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
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:
|
Use the LIBRARY attribute to
specify the shared library name. For example:
|
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:
|
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:
|
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
|
- 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 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 1.
In the following example, the
NUM-PARAMETERSattribute is set to the number of parameters that the shared library routine expects, followed by aSET-PARAMETER( )method call for each parameter:hCall:NUM-PARAMETERS = 2. hCall:SET-PARAMETER( 1, "LONG", "INPUT", msecs). hCall:SET-PARAMETER( 2, "INTEGER", "INPUT", 5000).