I am using MATLAB’s generic DLL interface functions to load a DLL. One of my DLL functions takes as an input a user-defined C structure, of which one of the fields is a pointer. For example, my C structure might be defined as:
struct my_struct { long size_a1; unsigned char *a1; long size_a2; double *a2; };
I have some functions:
void allocateStruct(struct my_struct** val)void readMyStruct(struct my_struct val)
When I attempt to examine the values of the structure returned by allocateStruct, I get:
ERROR: ??? The datatype and size of the value must be defined before the value can be retrieved.
Also, if I create the structure in MATLAB using LIBSTRUCT and attempt to set the value of a1, I get an error: ERROR: ??? Array must be numeric or logical or a pointer to one.
Best Answer