Hi, I'm trying to pass a function pointer as an out parameter from a native shared library. In the attached program there is a small shared library that has one GetCallback function that returns a callback function, and one that passes it as an out parameter.
The version that just returns it works fine, but the one that passes by
out parameter fails with this error:
$ mono CallbackTest.exe
** ERROR **: file marshal.c: line 6686 (emit_marshal_object): assertion
failed: (!t->byref)
aborting...
Stacktrace:
Native stacktrace:
mono [0x81705fb]
[0xffffe440]
/lib/libc.so.6(abort+0x108) [0xb7d528e8]
/usr/lib/libglib-2.0.so.0(g_logv+0x435) [0xb7ed1f35]
/usr/lib/libglib-2.0.so.0(g_log+0x29) [0xb7ed1f69]
/usr/lib/libglib-2.0.so.0(g_assert_warning+0x78) [0xb7ed1fe8]
mono [0x80b5330]
mono [0x80b5cb8]
mono [0x80ba749]
mono [0x80bb758]
mono [0x814fed9]
mono [0x815c253]
mono [0x815dabb]
mono [0x815dff1]
mono(mono_runtime_exec_main+0xb8) [0x80e82b8]
mono(mono_runtime_run_main+0x1b4) [0x80e9704]
mono(mono_main+0xf9f) [0x805b5ff]
mono [0x805a172]
/lib/libc.so.6(__libc_start_main+0xdc) [0xb7d3dfdc]
mono [0x805a0c1]
Debug info from gdb:
(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
0xffffe410 in __kernel_vsyscall ()
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Aborted
I'm running mono 1.2.6 and gcc 4.1.2 on gentoo-linux.
Note that the line that calls the "offending" version of GetCallback is
commented in the attached code, to show that the other version works well.
Have I done something wrong, or is it a bug in mono? Is there a
workaround (I'd prefer to keep the workaround in the c# code, rather
than changing the native dll).
Happy New Year,
Lars
mono_callback_test.tar.gz
Description: application/gzip
_______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
