wrapping a fixed size c array variable in c#
Carlos Frederico Biscaya <[email protected]> Wed, 9 Dec 2020 13:54:11 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CANWOLaYwn2tftBON0QzjpOZTbOb795j0PsjtbVouJA6h0r6+nw@mail.gmail.com> |
Hi everyone,
I have a simple 1D unsigned short array of fixed size in C that needs
wrapping. Basically it's part of a struct, but that doesn'T seem to matter
for my question.
For some reason, swig doesn't know / want to give me an array of UShort in
C# but keeps generating this annoying SWIGTYPE_p_unsigned_short. Using it
won't really help creating an intuitive wrapper.
Here is the minimalistic swig project I quickly built. The unsigned short
var was just to see, what type swig would use for marshaling an unsigned
short, if it wasn't an array.
---snip---
%module SwigExperimentWrapper
unsigned short bla;
unsigned short someUShortArray[33];
struct ImportantData
{
unsigned short someUShortArrayInStruct[33];
};
--- /snip ---
What I would like as output is something like this
class ImportantData
{
ushort[] someUShortArrayInStruct = new ushort[33]; // or whatever fits
the original data structure best
}
I get this feeling I am missing something, but I am not sure what. Sorry,
if this sounds trivial.
Please help,
yours
Fred
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user