[Mono-devel-list] Writing assembly

Ben Maurer 05mauben at hawken.edu
Thu Feb 12 12:15:25 EST 2004


No, there is not a way to do this easily. Your best option is to use a Perl script that would take the compiled class and turn it into S.R.E code to emit the same IL.

One other possibility is that the runtime guys could hack something up for you that would copy the code from one assembly into one that is being built. However, this prevents you from using your impl on the MS runtime (eg, you cant copy just your code and compile/run on MS). Although this seems unimportant, it actually opens some unique testing possibilities. For example, you can run a run a regex on a set of random string data under MS and your impl, and see if they come out the same. Or you can do some performance testing of how fast your compiler is. Not a big deal, but if you dont have to loose it you should not.

Also, for code that will be going into many assemblies, you should optimize it a bit by hand for size. Eg, mcs does not emit short jumps, but you can code those in yourself. There are many other ways you can work on reducing size, and some pretty cool tricks you can do in IL.

-- Ben

>>> Eric Durand-Tremblay <eric.durand-tremblay.1 at ulaval.ca> 02/12/04 11:34 AM >>>
Hello all,

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)


Eric Durand Tremblay
TIP-Mono Team
Blogging : http://aeglos.dyndns.org/tip-mono

Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com

More information about the Mono-devel-list mailing list