Having developed it, I can certainly appreciate your concerns about the mergebin util. It was basically developed out of sheer stubbornness not to let the Compact Framework box me into something I didn't want to do. The thought process was: the desktop linker can mix native and managed code into a single assembly, why can't we do it on CE? So I spent weeks researching the process of how the linker merged the two on the desktop. Digging into the PE headers, reading the articles, examining the SSCLI (the source code behind .NET) etc. Eventually I figured it out, and designed mergebin to do on the back-end what the linker does on the front-end.
So mergebin became the tool of choice. The actual process of merging the two binaries is really simple. A managed DLL is nothing more than a thin wrapper of native code to deliver a chunk of managed code. In the beginning this was a really simple thing to merge. Just make a hole, throw the managed code into it, fixup a few pointers, and re-sign it.
After trucking along for more than two years though, SQLite had made enough changes that I eventually encountered the strong name bug on CE. For the last 6-8 months, its been a nightmare to deal with. The hack I had in place was a Super Kludge (tm). It worked for most CE environments, but finally met its match in WM6.1. To be honest, I hated the kludge. Every release I always wondered "is this gonna be the one that breaks it?"
What I've finally come up with today at long last, is a permanent fix. The merged CF DLL is 100% right and doesn't kludge any of the numbers anymore on the CF, which is fantastic. It's still one additional step that I have to make on the CF that I don't have to make on the desktop, but the step is pretty benign, and just basically prevents the linker from merging the .bss segment with the .data segment -- its a linker optimization I'm prepared to live without, especially if it gets me where I want to be with the strong name.
Robert