The DLLOpen() DLLCall() functions support
the simple types in cicode. To pass a structure as an argument to a
DLL function you must write a DLL wrapper function which takes
simple arguments and builds up the structure. This structure is
then passed to the function you want to call. For example the
function StructFunc() takes a structure as an argument. By writing
StructWrapper function and calling this function you may pass the
structure.
typedef struct
{
int nArg;
char *pStr;
} MYSTRUCT;
// this function takes a structure as the argument
void
StructFunc(MYSTRUCT* pStruct)
{
}
// wrapper function has simple arguments
void
StructWrapper(int nArg, char* pStr)
{
MYSTRUCT s;
s.nArg = nArg;
s.pStr = pStr;
StructFunc(&s);
}
See also Q1374
|