> > Ah, ok. I thought the unverifiable CIL was basically just machine code. > > I didn't know it used the stack machine: cool! > > You have to distinguish between _unverifiable_ code, and _unmanaged_ code. > The former uses the stack machine, the latter is just machine code.
Ah, ok, I see. > > Ok. There are _inherently_ difficult parts though. For example, you > > can't really translate '#ifdef BIG_ENDIAN' style code into a portable > > representation, no matter what it is. > > That's true. But code which uses #ifdef BIG_ENDIAN is not > standard-conforming C code. How is it not? Though not the best designed, there is a ton of code that contains their own byte swapping routines, which do different things on hosts of different endianness. > > The hardest part is probably handling all of the libc functions that > > everyone expects: signals, stdio, etc. > > Right. For most of that, you can implement it using PInvoke to invoke > the underlying (run-time) platform's libc. However, because there are > a lot of macros that the C standard specifies are (compile-time) constant > expressions, you would have to wrap a lot of the functionality. > That is, you'd need to define your own set of C header files that define > the constants in a platform-independent way, and then have the implementation > of the C functions work by PInvoking your own C wrapper functions which > convert these constants to the appropriate platform-specific values and > then invoke the wrapped libc function. Yup exactly. The problem is doing it in such a way that running the code managed gives you an advantage though: which means that it should interoperate fairly well with the existing runtime and stuff. *shrug* Also, if you want the resulting CLI code to be portable to other systems, then you will have to provide ALL of the header files. On solaris, for example, 'stdin' is a #define for __iob[0], which obviously doesn't work too well if you run the binary on glibc. :) -Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/ _______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
