[Mono-list] mono_jit_init and mono_jit_cleanup

Rodrigo Kumpera kumpera at gmail.com
Sat Apr 18 15:33:54 EDT 2009


You should init the runtime only once.

On Sat, Apr 18, 2009 at 3:32 PM, fozzie <david_aiken at yahoo.com> wrote:

>
> hi all..
>
> I'm embedding mono in a Vista application which accesses multiple
> assemblies. For each assembly i call mono_jit_init, make the calls, then
> mono_jit_cleanup. The problem is that on the second call to mono_jit_init
> there is a crash in ...\mono\mini\mini-x86.c(611):
>
>                if (!func) {
>                        ptr = mono_global_codeman_reserve (sizeof
> (cpuid_impl));
>                        memcpy (ptr, cpuid_impl, sizeof (cpuid_impl));
>                        func = (CpuidFunc)ptr;
>                }
> >>              func (id, p_eax, p_ebx, p_ecx, p_edx);
>
> The mono_global_codeman_reserve returns a bad pointer.
>
> I get the same behavior if i make the following modification to the teste.c
> embedded sample:
>
> ...
>    mono_config_parse (NULL);
>    for(i=0;i<10;i++)
>    {
>            domain = mono_jit_init (file);
>            mono_add_internal_call ("MonoEmbed::gimme", gimme);
>            main_function (domain, file, argc - 1, argv + 1);
>            retval = mono_environment_exitcode_get ();
>            mono_jit_cleanup (domain);
>    }
>    return retval;
> ...
>
> Here i get a crash the second time mono_jit_init is called.
>
> Am i doing something wrong? If not, is there a workaround that i can use?
>
> thanks!
> --
> View this message in context:
> http://www.nabble.com/mono_jit_init-and-mono_jit_cleanup-tp23115883p23115883.html
> Sent from the Mono - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20090418/f4ec520b/attachment.html 


More information about the Mono-list mailing list