[Xapian-discuss] German Danish Russian
win 32
win32ster at gmail.com
Wed Sep 2 17:49:35 BST 2009
But this csharp/util.i doesn't even exist in the distribution. I also
examined xapian.i but wasn't able to find the relevant script code so
I just upload the complete XapianPINVOKE.cs file for those who are
interested:http://pastebin.com/f3d29676a
It is different in that it contains the UTF8StringMarshaler
marshalling class definition, all imported functions returning string
have
[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef =
typeof(UTF8StringMarshaler))]
attribute and all string parameters have this attribute (without
"return: ") too. I also applied the attribute to
SWIGStringHelper.SWIGStringDelegate although it can work without it
(utf-8 is converted into bad unicode, then the bad unicode is
converted back to utf-8 and finally at the return to calling function
utf-8 is converted into the proper unicode)
According to the SWIG doc you had pointed me to somewhere "string"
type should be mapped like
%typemap(imtype,
inattributes="[MarshalAs(UnmanagedType.CustomMarshaler,
MarshalTypeRef = typeof(UTF8StringMarshaler))]",
outattributes="[return:
MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef =
typeof(UTF8StringMarshaler))]") const char * "string"
but I have no idea which .i - file should be modified and the details.
It would also make sense to define the typemap only for windows .net
as you stated that the bindings work well for Mono.
Best regards,
Vasilij
> > I mean I've worked the solution out for me but it would be good to integrate
> > it into Xapian distribution. It is necessary to modify XapianPINVOKE.cs
> > (to add the UTF8StringMarshaler marshaller code and corresponding
> > marshalling attributes to import declarations).
>
> Yes, I understand.
>
> You need to modify the SWIG interface files (in particular
> csharp/util.i) so that this marshalling code is used. That probably
> means writing some SWIG typemaps, but I don't know the details for C#.
> The SWIG documentation I pointed you to seems to talk about this.
>
> Cheers,
> Olly
More information about the Xapian-discuss
mailing list