[Mono-dev] Embedded mono

BaSS bassraf at gmail.com
Tue Aug 26 15:23:00 EDT 2008

I forgot to ask, but now that the AppDomain.CreateDomain should be working again.. 
Would it be better to use the managed counterparts or keep using the C embed interfaced for domain creation (and unloading) ?
And why?

I'm kind of having a hard time doing the scripting integration the "right" way since there seem to be quite some approaches that can be used. Anyone with direct experience in this direction?

So far I'm thinking about this approach:

1) Create a root domain with the script compiler assembly loaded (using the unmanaged api)
2) Create secondary domains where I load the generated assemblies back from disk ( I can't use the CompilerResults.CompiledAssembly property since that would load the assembly into the root domain aswell, preventing me to unload the secondary domain successfully)
3) using the unmanged API find the published methods in the loaded assembly
4) execute methods in the loaded script assemblies directly from unmanged code

An other approach would be:

1) Create a root domain with the script compiler assembly loaded (from unmanged api)
2) Create secondary domains from within managed code and load the generated assemblies from disk (so we can unload the secondary domain without attachments to the root domain)
3) use the managed API and reflection to find the published methods
4) call published methods using unmanged -> manged calls and have the managed calls execute the methods.

Which approach (if any) would be the "best/fastest" ?
(another question would be, how to pass a loaded Assembly object back to the unmanged side, since simply unboxing won't work, right?)

Sorry for the bunch of hidden questions, but if anyone has some guidelines or directions for me, that would be great.

Best regards,

> -----Original Message-----
> From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-
> bounces at lists.ximian.com] On Behalf Of Robert Jordan
> Sent: Tuesday, August 26, 2008 19:40
> To: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] Embedded mono: first on disk dynamic assembly
> stays locked, while others do not.
> BaSS wrote:
> > Robert, awesome that it actually exposed a bug, I'm too new to mono
> > to be sure that its not me, so thank you for actually reproducing it
> > and posting the bug report.
> >
> > Loading all the created script assemblies into the root domain would
> > cause a huge memory consumption over time since I cannot unload the
> > unused (because the scripts changed) assemblies. Am I correctly
> > assuming this?
> This is correct, but it shouldn't harm much for non-production code.
> Anyway, there is a patch for this issue:
> https://bugzilla.novell.com/show_bug.cgi?id=420197
> Robert
> _______________________________________________
> 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