[Mono-list] Embeding mono. Error at mono_jit_exec
Alexander Smirnov
smsrecv at ya.ru
Mon Nov 23 15:37:11 EST 2009
Hello.
I'm trying to embed mono into a C application and I get an error when executing the compiled C code
(process:3817): GLib-CRITICAL **: g_path_is_absolute: assertion `file_name != NULL' failed
when executing mono_jit_exec() function
here is the C code:
#include <glib.h>
#include <mono/jit/jit.h>
#include <mono/metadata/assembly.h>
#include <stdio.h>
int main(int argc,char** argv) {
MonoDomain *domain=0;
int retval=0;
MonoAssembly *assembly=0;
char file_name[]="./empty.exe";
domain = mono_jit_init (file_name);
mono_config_parse(NULL);
assembly = mono_domain_assembly_open (domain, file_name);
printf("assembly=%d\n",(int)assembly);
mono_set_dirs(NULL, NULL);
mono_jit_exec (domain, assembly, argc-1, argv+1);
retval = mono_environment_exitcode_get ();
mono_jit_cleanup(domain);
printf("%d %d\n",(int)domain,retval);
return retval;
}
assembly "empty.exe" is compiled in MonoDevelop. with the runtime version NET 2.0
If to comment mono_jit_exec(), all functions works OK: domain and assembly is loaded OK;
I tried an absolute path and a relative path - no difference
empty.exe iitself is workin fine.
Full error message text:
(process:3817): GLib-CRITICAL **: g_path_is_absolute: assertion `file_name != NULL' failed
(process:3817): GLib-CRITICAL **: g_path_get_basename: assertion `file_name != NULL' failed
Stacktrace:
Native stacktrace:
/usr/lib/libmono.so.0 [0xb07f6a]
/usr/lib/libmono.so.0 [0xb3685c]
[0xd56410]
/usr/lib/libmono.so.0(mono_runtime_run_main+0xc9) [0xb568f9]
/usr/lib/libmono.so.0(mono_jit_exec+0x62) [0xaece72]
./run_empty(main+0xd2) [0x8048956]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0x461b56]
./run_empty [0x80487f1]
Debug info from gdb:
[Thread debugging using libthread_db enabled]
[New Thread 0x2f6b70 (LWP 3819)]
[New Thread 0xfbfb70 (LWP 3818)]
0x00d56422 in __kernel_vsyscall ()
3 Thread 0xfbfb70 (LWP 3818) 0x00d56422 in __kernel_vsyscall ()
2 Thread 0x2f6b70 (LWP 3819) 0x00d56422 in __kernel_vsyscall ()
* 1 Thread 0xb7788900 (LWP 3817) 0x00d56422 in __kernel_vsyscall ()
Thread 3 (Thread 0xfbfb70 (LWP 3818)):
#0 0x00d56422 in __kernel_vsyscall ()
#1 0x00875466 in nanosleep () from /lib/tls/i686/cmov/libpthread.so.0
#2 0x00bf7138 in ?? () from /usr/lib/libmono.so.0
#3 0x0086d80e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#4 0x005177ee in clone () from /lib/tls/i686/cmov/libc.so.6
Thread 2 (Thread 0x2f6b70 (LWP 3819)):
#0 0x00d56422 in __kernel_vsyscall ()
#1 0x00873f75 in sem_wait@@GLIBC_2.1 () from /lib/tls/i686/cmov/libpthread.so.0
#2 0x00b72bd3 in ?? () from /usr/lib/libmono.so.0
#3 0x00b99c2b in ?? () from /usr/lib/libmono.so.0
#4 0x00c13522 in ?? () from /usr/lib/libmono.so.0
#5 0x00c37bd7 in ?? () from /usr/lib/libmono.so.0
#6 0x0086d80e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#7 0x005177ee in clone () from /lib/tls/i686/cmov/libc.so.6
Thread 1 (Thread 0xb7788900 (LWP 3817)):
#0 0x00d56422 in __kernel_vsyscall ()
#1 0x00874c8b in read () from /lib/tls/i686/cmov/libpthread.so.0
#2 0x00b08156 in ?? () from /usr/lib/libmono.so.0
#3 0x00b3685c in ?? () from /usr/lib/libmono.so.0
#4 <signal handler called>
#5 0x00b568f9 in mono_runtime_run_main () from /usr/lib/libmono.so.0
#6 0x00aece72 in mono_jit_exec () from /usr/lib/libmono.so.0
#7 0x08048956 in main (argc=1, argv=0xbfc60584)
at /home/zzz/Projects/empty/run_empty/run_empty.c:19
=================================================================
Got a SIGSEGV 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
---
Alexander Smirnov
More information about the Mono-list
mailing list