Pretty simple except if you need to resize the array in the C code.
You can let LabVIEW create the necessary code for the function prototype and any datatypes. Create a VI with a Call Library Node, create all the parameters you want and configure their types. For parameters where you want to have LabVIEW datatypes passed to the C code, choose Adapt to Type. Then right click on the Call Library Node and select "Create C code". Select where to save the resulting file and voila.
This would then look something like this:
/* Call Library source file */
#include "extcode.h"
#include "lv_prolog.h"
/* Typedefs */
typedef struct {
LStrHandle key;
int32_t dataType;
LStrHandle value;
} TD2;
typedef struct {
int32_t dimSize;
TD2 Cluster elt[1];
} TD1;
typedef TD1 **TD1Hdl;
#include "lv_epilog.h"
void ReadData(uintptr_t connection, TD1Hdl data);
void ReadData(uintptr_t connection, TD1Hdl data)
{
/* Insert code here */
}
Personally I do not like the generic datatype names and I always rename them in a way like this:
/* Call Library source file */
#include "extcode.h"
#include "lv_prolog.h"
/* Typedefs */
typedef struct {
LStrHandle key;
int32_t dataType;
LStrHandle value;
} KeyValuePairRec;
typedef struct {
int32_t dimSize;
KeyValuePairRec elt[1];
} KeyValuePairArr;
typedef KeyValuePairArr **KeyValuePairArrHdl;
#include "lv_epilog.h"
void ReadData(uintptr_t connection, KeyValuePairArrHdl data);
void ReadData(uintptr_t connection, KeyValuePairArrHdl data)
{
int32_t i = 0;
KeyValuePairRec *p = (*data)->elt;
for (; i < (*data)->dimSize; i++, p++)
{
p->key;
p->dataType;
p->value;
}
}