arrays_csharp.i and INOUT[] generating wrong code?
Carlos Frederico Biscaya <[email protected]> Thu, 7 Jan 2021 15:35:17 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CANWOLab1Y7bF3ECVAEoCptNsjLj35wSDunD+a0P+5QFzYqgvfg@mail.gmail.com> |
Hi there,
I am trying to generate proper wrapping code for a c++ struct that looks
like this:
struct ImportantDataConst
{
static const unsigned short arraySize = 33;
unsigned short someUShortArray2[arraySize];
};
applying the unsigned short INOUT[] typemaps from arrays_csharp.i to the
contained array like this:
%apply unsigned short INOUT[] {unsigned short
someUShortArray2[ImportantDataConst::arraySize]}
which creates
public ushort[] someUShortArray2 {
set {
SwigExperimentWrapperPINVOKE.ImportantDataConst_someUShortArray2_set(swigCPtr,
value);
}
get {
global::System.IntPtr cPtr =
SwigExperimentWrapperPINVOKE.ImportantDataConst_someUShortArray2_get(swigCPtr);
SWIGTYPE_p_unsigned_short ret = (cPtr == global::System.IntPtr.Zero)
? null : new SWIGTYPE_p_unsigned_short(cPtr, false);
return ret;
}
}
Given the fact that ret is of type SWIGTYPE_p_unsigned_short and the return
type of the property is ushort[], I don't believe this is right. The
consequence is, that this code won't build. BTW. I get the same kind of
behaviour, when I use an OUTPUT[] typemap instead of INOUT[].
Is there a way to fix this quickly? Or am I missing something?
I would be truely grateful for any suggestions.
Br,
Fred
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user