I’m well aware of Java tools for manipulating, generating, decompiling JVM bytecode (ASM, cglib, jad, etc). What similar tools exist for the CLR bytecode? Do people do bytecode manipulation for the CLR?
I’m well aware of Java tools for manipulating, generating, decompiling JVM bytecode (ASM, cglib,
Share
Bytecode is a binary format. .NET assemblies work pretty different in terms of how they store the execution instructions.
Instead of compiling down to a bytecode-like structure, .NET languages are compiled into an Intermediate Language (in fact, it’s called just that–IL).
This is a human readable language that looks sorta like an object-oriented version of assembler.
So in terms of examining or manipulating the IL for individual assemblies, tools like Reflector and ILDASM allow you to conveniently view the IL for any assembly.
Manipulation is a bit different, I’d suggest taking a look at some of the AOP tools in the .NET space. I’d also suggest taking a look at Phoenix, which is a compiler project that MS has in the works. It has some really cool post-compile manipulation features.
If you want to know more about the .NET AOP tools, I’d suggest opening another question (that’s a whole other can of worms).
There are also several books that will teach you the ins and outs of IL. It’s not a very complicated language to learn.