Hi Jonas,
When using MATLAB's C++ interface with clibgen.generateLibraryDefinition(...), there can be issues with handling certain data types, especially when dealing with strings and fixed-size character arrays like wchar_t name[120]. MATLAB's interface generation can sometimes omit these members if it doesn't recognize them or can't handle them properly.
Here's a step-by-step guide on how to address the issue:
- Use clibgen.generateLibraryDefinition(...) to generate the interface for your C++ library. This will create a definition file (.def) and a MATLAB class that wraps the C++ class.
- Open the generated definition file (.def) and look for the class that should contain the name member. You might need to manually add the member to the definition. Since MATLAB might not directly support fixed-length wchar_t arrays, you might need to represent the data in a different way that MATLAB can understand, such as using a numeric array.
- After manually editing the definition file, use clibgen.buildInterface(...) to generate the MATLAB interface files (.m, .mlx, and possibly .cpp wrapper files).
- Since MATLAB does not natively support fixed-length strings as in C++, you might need to handle the conversion manually. One way to ensure the fixed length of 240 bytes is to use a numeric array of the appropriate size and type, and then handle the conversion between the numeric array and a string within MATLAB