I'm currently stuck wrapping a library that I cannot change due to a struct containing a fixed size unsigned short array, that I seem unable to wrap into something similar in C# using the wrapper generator SWIG.
I have created a minimalistic example swig project file that contains everything needed to reproduce my problem.
%module SwigExperimentWrapper
struct ImportantData
{
static const unsigned short arraySize = 33;
unsigned short someUShortArray[arraySize];
};
The resulting type for the array is not satisfactory. I was expecting something like a
fixed ushort someUShortArray[arraySize];
in C#, but I only get a SWIGTYPE_p_unsigned_short type, which indicates that SWIG probably doesn't have enough information on what to do with this array. Note, that the behaviour is the same if I just define the array without a struct.
I suspect that I need some typemaps for the solution, but first I need to understand, why it won't generate something that matches my expectation. I feel, I am missing something, but I had problems like this with SWIG before, and the problems seemed more relatable.
I'd appreciate any kind of input, as I have not been able to find anything on various searches.