DLL Procedure Parameters and C Data Types

When you define a parameter for a procedure that you are exporting from a DLL, you must specify the parameter's data type in ATEasy. First check the DLL vendor's documentation to see the data type of the parameter in the DLL. Then match that data type with its ATEasy equivalent. The tables below contain a list of Windows and C/C++ data types and their ATEasy equivalents.

 

Windows C Data Type

 ATEasy Equivalent

BOOL

Val Long ( 0 for false, 1 for true )

BOOLEAN

Val Long ( 0 for false, 1 for true )

BSTR

Val BString

BYTE

Val Byte

CHAR

Val Char

CY

Val Currency

CALLBACK*

Val Procedure

DATE

Val DateTime

DECIMAL

Val Decimal

DOUBLE

Val Double

DWORD

Val DWord

FLOAT

Val Float

HANDLE

Val AHandle

HRESULT

Val Long

IDispatch *

Val Object

INT

Val Long

LONG

Val Long

LPARAM

Val Long

LRESULT

Val Long

SCODE

Val Long

SHORT

Val Short

OLECHAR

Val WChar

UCHAR

Val Byte

UINT

Val DWord

ULONG

Val DWord

USHORT

Val Word

VARIANT

Val Variant

VARIANTARG

Val Variant

VARIANT_BOOL

Val Bool ( 0 for false, -1 for true )

VARTYPE

Val Word

WCHAR, wchar_t

Val WChar

WORD

Val Word

WPARAM

Val DWord

PBOOL, LPBOOL

Var Long

LPBSTR

Var BString

PBYTE, LPBYTE

Var Byte

PCH, LPCH

Var Char

PCHAR, LPCHAR

Var Char

LPCOLESTR

Val BString

PCSTR, LPCSTR

Val String

PCWSTR, LPCWSTR

Val BString

LPDECIMAL

Var Decimal (you need to create struct called Decimal)

PDWORD, LPDWORD

Var DWord

PFLOAT

Var Float

PINT, LPINT

Var Long

PLONG, LPLONG

Var Long

LPOLESTR

Val/Var BString ( Val if input only, else Var )

PSHORT

Var Short

PUINT

Var DWord

LPVARIANT

Var Variant

LPVARIANTARG

Var Variant

PVOID, LPVOID

Var Any

PWCH, LPWCH

Var WChar

PWCHAR

Var WChar

PWORD, LPWORD

Var Word

PWSTR, LPWSTR

Val/Var BString ( Val if input only, else Var )

 

C Data Type

 ATEasy Equivalent

bool

Val Char ( 0 for false, -1 for true )

char

Val Char

double

Val Double

float

Val Float

int

Val Long

long, long int

Val Long

short, short int

Val Short

unsigned char

Val Byte

unsigned short

Val Word

unsigned int

Val DWord

unsigned long

Val DWord

void *

Var Any

ATEasy's Any type accepts both VAL and Var type.

When a parameter is explicitly declared to be a pointer with an asterisk (that is, type * variable_name) and type has an ATEasy equivalent of Val xxx, you must change the ATEasy Val type to ATEasy Var. If there is no ATEasy Val xxx equivalent, then there is no ATEasy equivalent for that pointer type.

When a parameter is declared as a pointer in C (that is, type * variable_name), you can define the parameter in ATEasy as an array of the same type.

A function return type cannot be a pointer to an ATEasy type. You can define the function to return a DWord 4 bytes value to hold the pointer) instead and use MemoryCopy internal function toget the value from the pointer.

Pointers in C structure, should be declared as DWord (4 bytes value to hold the pointer), Use the ATEasy & operator to set the pointer and MemoryCopy internal function to set or get the value from the pointer.

In ATEasy 5.0, for a callback function as DLL procedure parameter, you can declare as Val param of type Procedure.  The procedure would be either one that defined in ATEasy or a DLL Procedure.  The validity of Procedure's (callback function's) definition cannot be checked by ATEasy, thus it is the user's responsibility to make sure exactly to define what is being required for its parameters.  Please see an example for callback function.