Method DllCallback():new() Foundation

Initializes a callback object.

Syntax
:new( [<cFunctionName>], [<nCallmode>] [, <nParameterType1>, ...] ) --> oDllCallback
Parameters
<cFunctionName>
The name of the function executed by the callback. Only non-STATIC functions can be specified. If no function name is passed, the method :execute() of the DllCallback object is executed.
<nCallmode>
Specifies the calling convention used by the DLL function when executing the callback as well as the callback's return type. One of the following #define constants from dll.ch must be assigned to <nCallMode> for specifying the calling convention:
Constants for the calling convention of callback functions
Constant Description
DLL_STDCALL *) Standard for Windows 32bit API
DLL_CDECL C calling convention
  1. Default

Callbacks used with Windows API functions use the calling convention DLL_STDCALL.

The return type of the DLL callback function can optionally be specified using the following #define constants. The contanst must be added to the calling convention with the '+' operator.
Constants for the return type of callback functions
Constant Description
DLL_TYPE_INT16 16 bit unsigned integer
DLL_TYPE_UINT16 16 bit signed integer
DLL_TYPE_INT32 32 bit signed integer
DLL_TYPE_UINT32 *) 32 bit unsigned integer
DLL_TYPE_INT64 64 bit signed integer
DLL_TYPE_UINT64 64 bit unsigned integer
DLL_TYPE_FLOAT32 32 bit floating point
DLL_TYPE_FLOAT64 64 bit floating point
  1. Default
<nParameterType1>, ...
The data type of the parameter(s) of the callback function can optionally be defined via a list of data types starting with <nParameterType1>. A #define constant from the following table must be specified for each parameter that is expected by the callback function. The constants are defined in the dll.ch include file.
Constants for the parameter type of callback functions
Constant Description
DLL_TYPE_INT16 16 bit unsigned integer
DLL_TYPE_UINT16 16 bit signed integer
DLL_TYPE_INT32 32 bit signed integer
DLL_TYPE_UINT32 32 bit unsigned integer
DLL_TYPE_INT64 64 bit signed integer
DLL_TYPE_UINT64 64 bit unsigned integer
DLL_TYPE_FLOAT32 32 bit floating point
DLL_TYPE_FLOAT64 64 bit floating point (double)
DLL_TYPE_STRING Character string
DLL_TYPE_XPPVALUE Xbase++ native value
Return

The class method :new() returns a DllCallback object.

Description

Objects of the class DllCallback are used with DLL functions which execute a callback as a part of their operation. The method :new() establishes a reference to the Xbase++ code which is to be executed in the callback. The code may either be located in a separate function, or it must be implemented in the :execute() method of a user-defined callback class derived from DllCallback. :new() also sets information such as the calling convention which is required for executing the callback function, and for processing its parameters.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.