[Xapian-devel] C# bindings and string typed return values

Dan Colish dcolish at gmail.com
Mon Apr 4 16:55:36 BST 2011


On Apr 4, 2011 3:35 AM, "Greg" <freediving at gmail.com> wrote:
>
> On Thu, Mar 31, 2011 at 11:30 AM, Olly Betts <olly at survex.com> wrote:
> > On Wed, Mar 30, 2011 at 01:06:39PM +0200, Gregory wrote:
> >> Generally the bindings work perfectly, except when called from an IIS
> >> application and only when the function being called returns a string
> >> eg. GetTerm() or GetValue(). Which results in the application pool
> >> crashing.
> >>
> >> Digging into the errors seems to yield the following "Attempted to
> >> read or write protected memory. This is often an indication that other
> >> memory is corrupt."
> >>
> >> I've done a little research on the topic and found the following
> >>
http://stackoverflow.com/questions/370079/pinvoke-for-c-function-that-returns-char
.
> >> Which suggests that the pinvoke implementation for string/char
> >> returning functions isn't implemented in a way that supports CLR calls
> >> (at least not in IIS).
> >>
> >> Is there something I could do to fix that on my end or is it something
> >> that needs to be changed in the bindings.
> >
> > I'm not really an expert, but it sounds to me like it would be hard to
> > work around, and should be fixed in the bindings.
> >
> > If you're able, the best approach would probably be for you to either
> > modify the generated code for one of these methods so that it works in
> > your environment, or produce a cut-down testcase which fails.  Then we
> > can usefully raise it with the SWIG developers.
> >
> > Cheers,
> >    Olly
> Sorry I'm resurrecting this topic but I've been doing some debugging /
> research on the string topic and it seem the problem is caused by a
> change in .NET 4.0 CLR which apparently was fixed in SWIG 2.x see
>
http://sourceforge.net/tracker/?func=detail&aid=2957375&group_id=1645&atid=101645
> for more information.
>
> Are there any plans to migrate Xapian to use the latest version of SWIG?
>

Moving to the latest SWIG bindings has been something we've discussed a few
times recently. I.think its a worthy goal, but it will require a lot of
testing. Most of the bindings only have smoketests. I would not be confident
making a change like this without a good picture of our binding test
coverage.

--Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20110404/64ba59dc/attachment.htm>


More information about the Xapian-devel mailing list