Suggestion to use common Win32 headers

Sean Kelly sean at invisibleduck.org
Thu Mar 6 10:02:43 PST 2008


== Quote from Sascha Katzner (sorry.no at spam.invalid)'s article
> Sean Kelly wrote:
> > Using basically any of them in a Windows app increased binary size
> > tremendously.
> That is simply wrong. Perhaps it was true in the far past, but as long
> as I know/commit to the Win32API project (~1 year) that was never the case.

It was when the package was in Tango, but that was over 1.5 years ago I believe.  The problem was that
all the constants were labeled 'const' rather than 'enum'.

> > * 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.
> The only file at the moment which is problematic is "winsock.d", because
> nobody seems to care enough to fix it... I think that is because there
> is no reason for it, if you have "winsock2.d". But nonetheless this
> is no problem, because the makefile accounts for this. The whole build
> process not even gives a warning.

Then things have improved tremendously since we looked at them, which was admittedly quite a while
ago.  I'll admit also that one reason Tango didn't stick with those headers was that, given the state they
were in at the time they appeared to require a dedicated maintainer, and neither Kris nor myself (the
two principal Windows folks at the time) had the time or inclination to do so.

> All you have to do, to use the Win32API headers:
> 1) type "make" in the project directory
> 2) link "win32.lib" and add the project directory to your include path
> > * 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).
> In the build process you can specify which version do you want, the
> default in the makefile is for example:
> 	DFLAGS += -version=Unicode -version=WindowsVista
> but you can easily specify other versions like "Windows2003",
> "WindowsXP" etc. ... this is all defined in "w32api.d".
> > 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 use them for every project... but then again I'm kind of a purist and
> don't like the existing window libraries in D. ;)

Me either :)  But they do the trick for what's in Tango.  From what you've said though, perhaps it's time
to revisit this decision.  If the full headers could be used in Tango without adversely affecting binary
size then I'd certainly consider the idea.


Sean



More information about the Digitalmars-d mailing list