Porting WIne to D

Francois Gouget fgouget at free.fr
Thu Jun 24 03:55:46 CDT 2010

On Wed, 23 Jun 2010, Christopher Selph wrote:

> Hi everyone, new here. I have been fooling around with the idea of porting
> WIne to the D programming language. What do you think would be the chances
> of sucess? D has the speed of C, but is a garbage collected language and
> OOP.

Garbage collecting:

Wine has strong requirements as far as the memory layout is concerned. 
Some applications don't expect to receive pointers to data above 3GB for 
instance. Windows also provides heap management routines and Windows 
applications create heaps, allocate memory inside them and don't expect 
things to move around. I suspect none of this would play well with 
garbage collecting. It would probably still be possible to use the 
garbage collector for a small fraction of Wine's allocations, but it 
seems to me that there would not be much point.


A lot of the Windows API is exported through DLL entry points and these 
are not object oriented. Where the Windows API is object oriented is:
 * For some msvcrt parts. But the name of the corresponding C++ 
   functions must be mangled in the Visual C++ way which probably does 
   not match the D way. So we would still need to do the impedance 
   adaptation in the spec file.
 * For COM objects. However these must have a very specific binary 
   layout for compatibility with Windows applications. Again I doubt D 
   objects would naturally generate the right datastructures. So you'd 
   need to add an impedance adaptation just like for C.

Wine also has very strong requirements with regards to threading, CPU 
register usage, exception handling, all of which require very low-level 
control which negates the advantages high level languages might have in 
these areas.

Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
        A polar bear is a cartesian bear after a coordinate transform.

More information about the wine-devel mailing list