[Mono-list] Mono 2.2 - P/Invoke - GetFunctionPointerForDelegate assertion
bhenderson at ipswitch.com
Thu Mar 19 16:36:21 EDT 2009
I am having an interesting problem with Mono 2.2 with trying to pass a
native function pointer to a function in the same native library. The
sample code below works with the .NET CLR, but dies in the mono runtime with
the following assertion/error (I have also tried changing the prototype for
the P/Invoke method to use the delegate, but get the same assertion when
calling the method):
ERROR:marshal.c:9235:mono_marshal_get_managed_wrapper: assertion failed:
This application has requested the Runtime to terminate it in an unusual
Please contact the application's support team for more information.
So.. my question is... Am I doing something wrong? Is this not supported
in mono? Is there a workaround for mono (other than LoadLibrary/dlopen) --
I would like to utilized managed code to do this and not have to add #if's
for different platforms!
Thanks in advance!
******* Code *******
extern "C" void TESTDLL_EXPORT foo()
extern "C" void TESTDLL_EXPORT bar(void (*fn)(void))
Test Program code:
public extern static void foo();
public extern static void bar(IntPtr foo);
public delegate void foo_delegate();
static foo_delegate my_foo_delegate;
static void Main(string args)
my_foo_delegate = new foo_delegate(foo);
IntPtr ptr =
View this message in context: http://www.nabble.com/Mono-2.2---P-Invoke---GetFunctionPointerForDelegate-assertion-tp22608410p22608410.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list