Applies To:
  • CitectSCADA 1.00 1.01 1.10 1.11 1.20 2.00 2.01

Summary:
Question: I want to call a DLL function which requires a structure as an argument. How can I do this using the DLLCall cicode functions? 

Solution:
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

 

Keywords:
 

Attachments