CALL
See also A-Z Spreadsheet Function List
Description Calls a custom function in a dynamic linked library (DLL).
Syntax CALL(file_name, func_name, data_type, argument_list)
file_name is the name of the DLL that contains the custom function. The file name should be provided as a quoted text string. You can also provide the path for the file.
func_name is the name of the custom function to be called from the DLL. The function name should be provided as a quoted text string.
argument_list is the list of arguments supplied to the custom function.
data_type is the data type, as a quoted text string, of the arguments and return value of the custom function. The following table lists the data type codes that can be used for this argument.
Data type Description Pass by C declaration
A | Logicial (False =0, True =1) | Value | short int |
B | IEEE 8-byte floating point number | Value | double |
C | Null-terminated string (255 characters maximum) | Reference | char* |
D | Byte-counted string (first byte contains string length; 255 characters maximum) | Reference | unsigned char * |
E | IEEE 8-byte floating point number | Reference | double* |
F | Null-terminated string (255 characters maximum) | Reference | char* |
G | Byte-counted string (first byte contains string length; 255 characters maximum) | Reference | unsigned char* |
H | Unsigned 2-byte integer | Value | unsigned short int |
I | Signed 2-byte integer | Value | short int |
J | Signed 4-byte integer | Value | long int |
L | Logical (False=0, True =1) | Reference | short int* |
M | Signed 2-byte integer | Reference | short int* |
N | Signed 4-byte integer | Reference | long int* |
Remarks For declarations made in C, it is assumed that your compiler defaults to 8-byte doubles, 2-byte short integers, and 4-byte long integers. In the Windows programming environment, all pointers should be far pointers.
Pascal calling conventions are used for all functions called from DLLs. For most C compilers, you must add the --Pascal keyword to the function declaration.
If the return value for your custom function uses a pass-by-reference data type, a null pointer can be passed as the return value. The null pointer is interpreted as the #NUM! error value.
For F and G data types, a custom function can modify an allocated string buffer. If the return value type code is F or G, the value returned by the function is ignored. The list of function arguments is searched for the first data type that corresponds to the return value type. The current contents of the allocated string buffer is taken for the return value. 256 bytes is allocated for the argument; therefore, a function can return a larger string than it receives.
You can use a single digit (n), with a value from 1 to 9, as the code for data_type. The variable in the location pointed to by the nth argument is modified instead of the return value; this process is referred to as modifying in place. The nth argument must be a pass-by-reference data type. In addition, you must declare the function void. For most C compilers, you can add the Void keyword to the function declaration.
Example CALL("\VTFORM1\DEMO4\CUSTFUNC.DLL", "Quotient", "BBB", 3, 2)