Suggestion to use common Win32 headers

Sean Kelly sean at invisibleduck.org
Wed Mar 5 14:46:36 PST 2008


== Quote from bobef (bobef at abv-nospam.bg)'s article
> Trevor Parscal Wrote:
> > As the person who contributed Tango's minimal windows header, and also has authored a new even
more restrictive header for my own project UniD, I feel I may be a good person to answer this question.
> >
> I didn't intend to insult you by saying 'minimal'. In this context 'minimal' means only the types and
constants basically, which are very useful, of course. The problem is
> 1) These are not common with Phobos. I.e. Phobos may provide less (or more) win32 types and
constants.
> 2) Other libraries are not using these (probably because of 1)
> 3) This causes conflicts
> 4) There are no functions, only types and constants
> > "Windows headers" can mean just windows.h or poitentially hundreds of files which for the majority
of users are not needed. Even with automatic conversion software (h2d) it is a tedious process to get
bug-free D modules from C header files.
> >
> > So it's often been a question of scope; how many headers should we consider "common"?
> >
> I am not saying 'common'. I am saying all (or most of) win32 headers. There is no need for
conversations or anything. The headers are already there -
http://dsource.org/projects/bindings/browser/trunk/win32
> So what needs to be done, IMHO, is for Phobos and Tango to adopt these.

Tango actually originally used these headers, but dropped them early on because there were some
problems with them.  They may since have been fixed, but the issues I remember are:

* The headers are immense and interlinked.  Using basically any of them in a Windows app increased
binary size tremendously.

* Some of the headers were broken, and because of the size and number of headers, fixing them proved
to be somewhat complicated.  The extension of this being that maintaining the headers promised to be
a considerable task that no one wanted to take on.

* Windows has some versioned headers that conflict with one another, such as the winsock and
winsock2 headers.  The bindings project didn't provide any good way to handle this at the time, and it
caused problems with some applications (for me anyway).

Also, very few people really need the bulk of what's in the Windows headers.  Tango has been using
Trevor's headers for ages now, and the number of requests for Windows header additions is practically
nil.  I'm inclined to say that the bindings project is really better suited to be maintained and distributed
separately.  It decreases maintenance load on Tango/Phobos, allows the default impl. to remain slim,
and still allows those who have need of the full set to download/use them.  It's probably also worth
noting that neither Tango or Phobos contain a full set of headers for any other OS either.


Sean



More information about the Digitalmars-d mailing list