Suggestion to use common Win32 headers

Sascha Katzner sorry.no at spam.invalid
Thu Mar 6 04:07:42 PST 2008


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.

> * 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.

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. ;)

LLAP,
Sascha

Project: http://www.dsource.org/projects/bindings/wiki/WindowsApi
Forum:   http://www.dsource.org/forums/viewforum.php?f=30



More information about the Digitalmars-d mailing list