Hi Lucas,

thank you very much! 
Implementing your answer mad me stumble over this one 
https://bugzilla.novell.com/show_bug.cgi?id=624498.
Did you find a workaround? Win7 is one of my deployment platforms.

On a related note is there a way to invoke the mcs compiler from within the 
code to compile some .cs file.
Of course one could try to invoke mcs with a system call or ExecuteProcess but 
is there something more convenient? 
As far as I read about the evaluator it seems not to so well suited for this 
purpose since i don't want/ need line-by-line action or repl.

-Frank


Am 24.07.2010 um 13:53 schrieb Lucas Meijer:

> Hey Frank,
>> I want to test mono for embedding it into my C++ application. I was 
>> following the articles http://www.mono-project.com/Scripting_With_Mono, 
>> http://www.mono-project.com/Embedding_Mono and the examples here 
>> http://anonsvn.mono-project.com/viewvc/trunk/mono/samples/embed/.
>> So far everything worked well, although I don't understand the restriction 
>> for mono_jit_init to be callable just once.
>> So I'm able to load assemblies into the domain and run them, as well as 
>> expose some c methods to the Jit. It is possible to load different 
>> assemblies, but obviously each assembly can be loaded only once. If the 
>> assembly changes on disk after the first load calling 
>> mono_domain_assembly_open again, does not reload the changed assembly.
>> Is there any way to achieve the reloading?
> You can only call mono_jit_init() once.  However you can achieve what you 
> want by creating a new domain (mono_domain_create()),  and loading your 
> assemblies in that domain.  when you decide you want to reload an assembly, 
> you would need to unload your domain, and create a new one again in which you 
> can load your updated assembly.   (on win32, you need to make sure you load 
> your assembly into memory first, and ask mono to load it from memory, 
> otherwise it will keep a lock on the on disk assembly, preventing another 
> process from overwriting it).
> 
> This does mean that you basically loose all your instantiated objects and 
> program state.   Depending on what problem you're trying to solve, you can 
> try to somehow store your program's state,  then unload domain, recreate 
> domain,  and then somehow restore your program's state.  that's what we do in 
> unity.
> 
> Be aware that there's quite significant memory leaks currently when unloading 
> a domain.  It's mostly leaking wrapper functions in marshall.c. Depending how 
> on much code you've jitted it might or might not become enough to be a 
> problem.
> 
> Bye, Lucas

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to