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