[Mono-dev] [PATCH] Allows mono_jit_init to be called multiple times without crashing.

Tom Hindle tom_hindle at sil.org
Fri Jan 30 13:41:17 EST 2009


Hi,

Attached for review is a patch that allows multiple calls to
mono_jit_init.

I appreciate that the first response to this request may be, 'why would
you want to do that?' Given that, I will attempt to give a
justification.

The reason I need to be able to do this is because:

I have an existing C# application that uses native COM objects, with
marshaling iterops automatically generated from the COM IDL files, as
part of the build process.

However as part of the Linux port I sometimes need to replace select COM
objects with C# ones. I inform the application of this by changing the
registry. (COM definition file on linux)

Which I can do because previously I have created a managed-Com-bridge (a
special native COM object that embeds mono and loads managed COM
objects, before retuning a native ptr back through the COM framework). 

However, since the managed-Com-bridge embeds mono, I need to call
mono_jit_init to return the domain. However since mono is already
running, a call to mono_jit_init asserts! 

Furthermore, COM objects are sometimes created indirectly by other
native COM objects, meaning re-factoring C# code is not an option. For
example, C# creates native COM object COM1 which itself creates COM2,
which has now been replaced by a managed COM object.


Thanks,
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: allows_mono_jit_init_to_becalled_multiple_times-r122675.patch
Type: text/x-patch
Size: 435 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090130/f418fc01/attachment.bin 


More information about the Mono-devel-list mailing list