[Mono-dev] Creating AppDomains From Embedded Mono
Jim Purbrick
jimpurbrick at yahoo.co.uk
Tue Jan 10 21:21:48 EST 2006
Hi Everyone,
I seem to have fixed my build problems: I ran make
again without changing anything and managed to build
the mono 1.1.13 tree in cygwin with the mono 1.1.13
windows installation. Slightly disconcerting as it
crashed the last time I tried it...
I can run the Second Life simulator again and have it
load the new 1.1.13 mono.dll, run ilasm.exe and my
bytecode transformer, but the evil hack I've been
using to create new AppDomains for the Mono scripts
seems to be unravelling.
To create a domain I execute an assembly in the root
domain which creates another domain and executes
another assembly:
public static void Main()
{
AppDomain new_domain =
AppDomain.CreateDomain("Secondary Domain" +
sDomainIndex++);
new_domain.ExecuteAssembly("DomainRegister.exe");
}
DomainRegister.exe then just makes an internal call
which uses mono_domain_get to give me a C reference to
the new domain, which is set up properly by the C#
code. mono_domain_set can then be used from C code to
switch
between secondary domains without any problems.
public class DomainRegister
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static void register_domain();
public static void Main()
{
register_domain();
}
}
Everything I tried to do in C to create the domain
left it partially initialised and things would crash
later on.
To unload domains I just call
ves_icall_System_AppDomain_InternalUnload which I have
to declare as an extern as it's not in the public
headers. Again, it's a hack, but it seems to work.
Does anyone know what might have changed recently to
cause this to crash on Windows when the
AppDomain.CreateDomain call is made?
Even better, is it now possible to create properly
initialised AppDomains using the embedding API without
having to call in to managed code and then back in to
unmanaged code again?
Thanks for all your help over the last couple of days.
Hopefully we can get over this (hopefully) last hurdle
and I can get the Mono SL running on Windows again.
Cheers,
Jim.
___________________________________________________________
Does your mail provider give you FREE antivirus protection?
Get Yahoo! Mail http://uk.mail.yahoo.com
More information about the Mono-devel-list
mailing list