Re: arrays_csharp.i and INOUT[] generating wrong code?
Carlos Frederico Biscaya <[email protected]> Mon, 11 Jan 2021 11:04:00 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CANWOLaaRF9rXaaGXq-Y9_w3HFqySyGzDxw6C2MKNGCsYm=FudA@mail.gmail.com> |
Since half a week has passed and nobody responded, I guess my question was "wrong" ? I am stuck, and can't get this problem fixed on my own. Please help. Am Do., 7. Jan. 2021 um 15:35 Uhr schrieb Carlos Frederico Biscaya < [email protected]>: > 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