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

Olly Betts olly at survex.com
Thu Mar 31 10:30:22 BST 2011


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



More information about the Xapian-devel mailing list