Some structures not being created properly from header files when using libstruct

5 views (last 30 days)
Hi, I’m having issues with the libstruct function for certain types of structures in some shared libraries I’m working with. The structures are defined in a couple of ways in the header file. I’m not familiar enough with C to know the difference between these.
Type 1
typedef struct
int value1;
short value2;
Type 2
typedef struct _typeName{
int value1;
short value2;
Structures that have _typeName before the contents of the structure are specified don't seem to work.
Structures that are defined in the first form work fine with libstruct, those defined in the second way give me an error that says “Undefined function or variable ‘lib.typeName’”
I've tried creating the libstructs in two ways, with and without pre-creating an associated matlab structure.
and also by first creating myStructML
myStructML.value1 = 0; myStructML.value2 = 0;
myStruct=libstruct('typedef', myStructML);
I get the same error for the structs that appear in the header file in the Type 2 format in both cases.I'm using 2019b on Windows 10.

Answers (0)


Find more on C Shared Library Integration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by