[Mono-dev] Creating AppDomains From Embedded Mono

Jim Purbrick jimpurbrick at yahoo.co.uk
Wed Jan 11 08:12:25 EST 2006

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.



Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

More information about the Mono-devel-list mailing list