[Mono-dev] Re: AppDomain from unmanaged code and handle_thunk
Robert Jordan
robertj at gmx.net
Fri May 5 20:40:30 EDT 2006
Joachim Ante wrote:
> Hi,
>
> We are embedding mono in our application, whenever a user changes a C# file
> we recompile and reload the assembly. Whenever i reload an assembly i want
> to create a new AppDomain and activate it.
> The problem is i need to do this or at least start the process from c code.
>
> Optimally i want to:
> 1. Unload the old app domain
> 2. Create a new app domain
> 3. Load all assemblies into it
> 4. Execute some code in it
> 5. When the user changes a C# file, repeat the whole processs.
>
>
> At the moment i am calling a C# function from C which will simply create a
> new apdomain using AppDomain.CreateDomain("UnityRuntime");
>
> Then i activate the app domain from c code using:
> ves_icall_System_AppDomain_InternalPushDomainRefByID (domainID);
> ves_icall_System_AppDomain_InternalSetDomainByID (domainID);
>
>
> That works fine in most cases but i sometimes get an abort in mini-ppc.c
> line 2329:
>
> if (pdata.found != 1)
> g_print ("thunk failed for %p from %p\n", target, code);
> g_assert (pdata.found == 1);
>
>
> I am wondering what does this abort mean?
>
> Since the code works fine if i don't create and activate those domains, i
> presume there is something wrong with how i activate the domain.
> I tried a lot of different ways of activating the domain most of which just
> crashed in random places and this one got me farthest.
>
> What is the recommended way of activating/creating/unloading an appdomain
> from c code?
The recommended way is to do it from managed code.
Please search the archive, because there was a discussion
about this a couple of months ago.
Robert
More information about the Mono-devel-list
mailing list