[Mono-devel-list] Seemless Executibles?

Jonathan Pryor jonpryor at vt.edu
Fri Jun 18 07:10:35 EDT 2004


On Thu, 2004-06-17 at 18:20, Tom Larsen wrote:
> Don't quote me on this since I'm not a PE format guru but I believe
> at least on Windows .Net executibles pull a small feature to fake out
> the execution environment.  When you run or double click on a .Net built
> exe file, the system loads the binary where the PE header tells the system
> to load a publicly exported "start" function found in mscoree.dll and
> from there on out, this is responsible for IL execution.  The binary
> executible basically does a "redirect" to the IL interpter so the OS
> can't tell the difference and handles these binaries like old Win32
> bins.

It should be noted that this occurs only for pre-Windows XP systems. 
Windows XP doesn't depend on this feature, and has a system similar to
binfmt_misc on Linux to launch .NET programs.

> So here is the big money question: Can the mono runtime do this?

No.  Mono could do this, but only for Windows systems.  Since Unix-like
systems are the primary target for Mono, it is unlikely this will be
done unless it's contributed.

Why would this work only for Windows?  File format differences.  .NET
programs use the Portable Executable (PE) format, which (conveniently)
is the same format used by all Windows executables.  Thus the normal OS
loader can be used, allowing the seamless integration.

Linux, and most other Unixes, uses ELF.  Mac OS X uses Mach-O.  Neither
of which are similar enough to PE for the normal OS loader to think that
a PE program should be passed to the normal boot loader... ;-)

Consequently, the same trick can't work off Windows, though it would
work for any OS that uses PE as the native program format, such as
ReactOS.

Linux doesn't need the same trick anyway; binfmt_misc can be used for
seamless integration, though the Wine/Mono conflict can be annoying and
needs a proper solution.  I would assume other Unixes have similar
features.

 - Jon





More information about the Mono-devel-list mailing list