I have run into a problem with custom marshaling of pointers being passed from C# to natively compiled code. The essense of it is that my custom marshaler's MarshalManagedToNative() returns an address to be passed to a native function, but the native function always receives an address that is four bytes greater than what my MarshalManagedToNative() returned. My code works with versions of Mono as new as 0.30.2, but it does not work with 0.31 or Beta 1. It also works with the .NET Framework 1.0 and 1.1.

I have attached a small example that demonstrates the problem. The code is culled down from what I am actually attempting to do so that it demonstrates the problem while still implementing the basic functionality that I need. With Mono 0.31 and Beta 1, the native function handleBase() determines that the pointer passed into it from the managed environment does not match the pointer allocated by new_Base().

As I said, the value is consistently off by four bytes, but only when a custom marshaler is involved. Has there been a semantic change in Mono that I need to take into account, or (worst case for me) has my code been flawed from the beginning?

 -Patrick


-- Patrick L. Hartling | Research Assistant, VRAC [EMAIL PROTECTED] | 2274 Howe Hall Room 2624 http://www.vrac.iastate.edu/~patrick/ | http://www.vrac.iastate.edu/ PGP: http://wwwkeys.gpg.cz:11371/pks/lookup?op=get&search=0xEBF86398

Attachment: marshal_test.tar.gz
Description: GNU Zip compressed data


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to