Cecil and the CCI 18 Apr 2009


Ponton Quite a number of friends pinged me about the recent release of the CCI, under the Ms-PL, and were curious about my take on it, and its effect on Cecil and its ecosystem. First of all, there's a bit of a story here, and I'll write it here for those who like me, love software history. Back in the years 2003 and 2004, I was working with Thomas Gil, one of my mentor and programming hero, on one of the first static aspect weaver on .net, AspectDNG, now abandoned. I was actively researching better ways to do CIL injection. We went from raw IL text manipulation, to Reflection and Reflection.Emit using Lutz's ILReader library, to RAIL, until I decide to work on Cecil. In the meantime, I've stumbled upon ILMerge, a tool from Mike Barnett, and mailed him to ask what powered the tool, and he put me in contact with Herman Venter, the man behind the CCI effort. I wrote Herman a couple of mails, in a terrible English, and begged him to push for a release of the CCI under a license we could use in AspectDNG. That was in March 2004. As you can guess, it quite didn't work out at that time, so I started working on Cecil. A few weeks after, Miguel blogged about the need of such library. He already had the Mono Linker in mind. I mailed him, got SVN access, checked in the beginning of Cecil, got S├ębastien interested, etc. I had the opportunity to be invited by Microsoft to attend an informal AOP workshop the year later, and to met with Herman, which I remember as a very nice person. I am not sure he remembers the terribly shy kid that did a terrible presentation in a terrible English. But all in all, I'm happy that five years later, my request went through. Now the CCI release in its own CodePlex page is not really a big event, as it was already released and licensed under the Ms-PL, as it's part of Sandcastle. Anyway, Cecil is quite mature in its current form, it's used by a fair number of (known) applications (please help to improve the list), and I'm currently working on two things. The first one is a refactoring of Cecil, which vastly reduces memory consumption as well as reading/writing time. Hopefully I'll have a beta in a month or so. We have great plans for this version of Cecil, and it's consuming a lot of my time, more on this later. The second one is an extensible decompiler, Cecil.Decompiler, that will greatly benefit from the Cecil refactoring. The time I dedicate to it is a bit phagocyted by the Cecil refactoring right now, but it's certainly one of my favorite project. The CCI is a combination of Cecil, the decompiler, and something to write a decompiled AST back, which will be the natural evolution of the Cecil decompiler. Note that the CCI decompilation/compilation process is not extensible. Now that it's open source, you can hack it yourself, sadly, the CCI code is well, a bit messy to be polite, or not exactly a joy to read. Also you probably won't be able to contribute back to the CCI. Anyway, it does its job alright, and so does Cecil. Choice is always good, let's welcome the CCI in the small family of such tools. I, for one, will surprisingly keep hacking on and with Cecil :) To conclude on a very positive note, the fantastic thing about this release is that the CCI contains a fully managed PDB reader and writer. That's great news as so far, we failed to get any details about this file format. This means that we can now implement a fully managed Mono.Cecil.Pdb support, and that's just great. UPDATE: it appears that only the PDB reader is fully managed, the PDB writer is just a wrapper over the COM stuff, just like the current implementation of Mono.Cecil.Pdb. Well, at least it's a start.