Command EXTERN Foundation
Declares a function in a non-Xbase++ DLL.
[STATIC] EXTERN [<CallingConvention>] [<Type>] ;
<FunctionName>( [[@] <Parameter> AS <Type>, ...] ) ;
IN <Library> [NAME <ExportedName>]
Key word | Description |
---|---|
CDECL | C calling convention |
STDCALL *) | Standard for the Windows 32bit API |
|
Key word | Description | Corresponding C/SDK types (examples) |
---|---|---|
BOOL8 | 8 bit boolean | bool |
BOOL | 32 bit boolean | BOOL |
SHORT | 16 bit integer | SHORT, short int |
USHORT | Unsigned 16 bit integer | USHORT, unsigned short |
INTEGER | 32 bit integer | int |
LONG | 32 bit integer | INT32 |
UINTEGER | Unsigned 32 bit integer | DWORD, LPDWORD, LPARAM, PVOID, HANDLE, HWND, UINT, ULONG |
INTEGER64 | 64 bit integer | INT64 |
UINTEGER64 | Unsigned 64 bit integer | UINT64, ULONG64, DWORD64 |
SINGLE | 32 bit floating point | FLOAT32, float |
DOUBLE | 64 bit floating point | FLOAT64 |
STRING | Character string | LPSTR, PSZ, char, char* |
IDISPATCH | COM/ActiveX object (IDispatch) | IDispatch* |
Key word | Description | Corresponding C/SDK types (examples) |
---|---|---|
BOOL8 | 8 bit boolean | bool |
BOOL | 32 bit boolean | BOOL |
SHORT | 16 bit integer | SHORT, short int |
USHORT | Unsigned 16 bit integer | USHORT, unsigned short |
INTEGER | 32 bit integer | int |
LONG | 32 bit integer | INT32 |
UINTEGER | Unsigned 32 bit integer | DWORD, LPDWORD, LPARAM, PVOID, HANDLE, HWND, UINT, ULONG |
INTEGER64 | 64 bit integer | INT64 |
UINTEGER64 | Unsigned 64 bit integer | UINT64, ULONG64, DWORD64 |
SINGLE | 32 bit floating point | FLOAT32, float |
DOUBLE | 64 bit floating point | FLOAT64 |
STRING | Character string | LPSTR, PSZ, char, char* |
IDISPATCH | COM/ActiveX object (IDispatch) | IDispatch* |
CALLBACK | Callback function | WNDENUMPROC, DLGPROC |
ACALLBACK | Asynchronous callback function | WNDPROC, HOOKPROC |
XPPVALUE | An arbitrary Xbase++ value | (not applicable) |
STRUCTURE | Memory structure | RECT, PROCESS_INFORMATION, typedef struct |
The EXTERN command is used for calling functions in non-Xbase++ DLLs. The command allows the utilization of functions within an Xbase++ application which are not known by the linker at the time when the EXE file is created. This includes operating system APIs as well as functions contained in 3rd party DLLs.
The command creates an Xbase++ wrapper function which has the same name as the function contained in the DLL file. This allows the DLL function to be called on the Xbase++ language level using a symbolic identifier. Because the EXTERN command creates a new function, it must appear outside of any existing function bodies.
When the Xbase++ function is called in a program, it first loads the DLL and then executes the DLL function of the same name. If parameters are declared in the EXTERN command, the Xbase++ function passes the received arguments to the DLL function. All parameters that are declared with a preceeding reference operator (@) are passed by reference to the DLL function. When the DLL function finishes, the DLL is unloaded and the Xbase++ function returns the return value of the DLL function.
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.