[Mono-dev] Mono on wine redux

Kornél Pál kornelpal at gmail.com
Thu Apr 17 03:17:24 EDT 2008


Hi,

> From: "Miguel de Icaza" <miguel at novell.com>
>> But what percent of .net apps are pure?  If that fraction is small,
>> as I suspect it is, then for Mono to really rock the world, it's going
>> to have to tackle impure apps, too.  That is of course incredibly 
>> difficult,
>> and would require considerable cooperation between the Mono and Wine 
>> projects.
>
> It is very hard to run into a mixed-mode assembly in the wild;   They do
> happen, but they are rare.   I can only think of three projects that had
> needed them in the history of Mono.

I've done some work on this. And actually I managed to run mixed-mode 
assemblies.

Note that it is only possible on Windows because native code is usually 
platform (arch and OS as well) dependent.

I implemented support for loading image files using LoadLibrary so that the 
NT loader will take care of the image patching. I also had to patch the 
in-memory image of mscoree.dll so that export address table point to 
functions in mono.dll that is required for LoadLibrary support. This also 
will enable Wine (and Windows is someone is willing to replace or modify his 
on-disk mscoree.dll image) to execute managed images using CreateProcess 
without creating a mono.exe child process. This was the hardest part.

IJW thunks (managed-to-native) are really P/Invoke methods with function RVA 
stored in method body RVA so it was very easy to implement, I only had to 
remove code preventing IJW from work.

V-table fixups (native-to-managed) are not difficult either but requires 
it's own wrapper methods so my current implementation probably will need 
improvements.

Note that this still will not make Mono able to use MSVCRT because that uses 
unmanaged API of .NET Framework that isn't implemented by Mono.

I am stilll working on a cleaned-up patch but will send to the list soon.

Kornél 



More information about the Mono-devel-list mailing list