[Mono-dev] Creating AppDomains From Embedded Mono

Zoltan Varga vargaz at gmail.com
Wed Jan 11 09:38:46 EST 2006


                                      Hi,

  MonoDomain is the internal structure used by the runtime to track appdomains,
while MonoAppDomain is the managed AppDomain object itself:

struct _MonoAppDomain {
	MonoMarshalByRefObject mbr;
	MonoDomain *data;
};

The data field of the MonoAppDomain object points to the corresponding
MonoDomain.

                    Zoltan

On 1/11/06, Jim Purbrick <jimpurbrick at yahoo.co.uk> wrote:
> Hi Robert/Everyone,
>
> > You can and *should* invoke the managed
> > AppDomain methods to load and unload domains.
> > You don't need an intermediate managed assembly
> > to do that (untested):
> >
> > MonoAppDomain*
> > createDomain (char *name) ....
> >
> > void
> > unloadDomain (MonoAppDomain *domain) ...
>
> That gets me a MonoAppDomain*, which I can presumably
> use to call AppDomain.Load(Byte[]) to load a script's
> assembly, which will be unloaded (along with JIT
> output etc.) when I call unloadDomain?
>
> How do I turn the MonoAppDomain in to a MonoDomain
> required by mono_object_new, mono_string_new etc.?
> That is what my intermediate managed assemblies were
> doing: executing an assembly in the new domain which
> would call mono_domain_get() to get me a MonoDomain*
> for the new MonoAppDomain.
>
> Do I even need a MonoDomain* for the new
> MonoAppDomain? At the moment I try to allocate any
> objects used by a script in the AppDomain that I
> loaded the script's assembly in to, but I suppose I
> could allocate the other objects in the root domain.
> Would there be any problems doing this? My concern
> would be that the root domain would end up loading the
> script's assembly which I then couldn't unload.
>
> Cheers,
>
> Jim.
>
>
>
>
>
> ___________________________________________________________
> Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



More information about the Mono-devel-list mailing list