[Mono-list] Re: [Mono-devel-list] Writing assembly

Jonathan Gilbert 2a5gjx302@sneakemail.com
Tue, 24 Feb 2004 00:33:19


At 04:06 PM 23/02/2004 +0100, you wrote:
>On 02/12/04 Eric Durand-Tremblay wrote:
>> Does anyone know a way to emit (with reflection) an already existing 
>> class (compiled in C#).  We looked at System.Reflection.Emit namespace 
>> but we are only able to save dynamicaly created assembly.
>> 
>> It could be usefull to do this when it is time to make our assembly 
>> compatible with MS runtime.  (Like saving some base class to assembly)
>
>I can't think of a reason why you'd need to save a base class to a
>different assembly: you just reuse the base class implementation by
>deriving from it.
>Care to explain why you think you need that? Either it is because of
>confusion or because of a design issue with our regex code: it's better
>to clear the confusion or fix the design issue before proceeding further.

Seems to me that without including the base support code, the saved regular
expressions wouldn't work on any runtime other than mono. I seem to recall
reading that compiled regexes can be saved to an assembly by some
roundabout procedure, after which it can be sent and loaded elsewhere. If
the saved form relies on a base class implementation internal to mono's
corlib, then it is effectively glued to mono. I believe what is desired
here is some kind of "template" that can be built upon during the compile
process, so that they don't have to inline miles of static
System.Reflection.Emit code. It should be possible to still derive from a
base class but include the base class -- unmodified -- in the resulting
assembly, no?

Jonathan