What's up with the windows headers?

Phil Lavoie maidenphil at hotmail.com
Thu Dec 27 10:55:54 PST 2012


Hi,

I am currently using the win32 api bindings project and the 
transition went smoothly. However, the "version" import library 
is not included in dmd's windows' libs, so we should have to keep 
that in mind, in order to provide a full out-of-the-box working 
installation.

I am willing to help but I am by no means a Windows savvy. Though 
I believe the book I am currently reading and my current project 
will take me a few steps ahead.

I have already modified some of the code provided. For example, 
no functions are declared "nothrow" in the provided headers. But 
I think they should. First of all, because they are, but also 
because if you want to call them in a win-proc (which HAS to be 
nothrow I believe) without using a try/catch block they have to 
be marked as such. So I just modify them as I use them. Though 
modifying one generally implies correcting a whole bunch (since 
only a "nothrow" clause has to be added to the "extern( Windows 
)" block...)

Also, I believe there are going to be some minor things that 
should be corrected. For exemple, the min and max templates 
provided as a substitute for their macro counterparts should be 
removed I believe. First of all because they are declared like 
this: template min( T ) { T min( T a, T b ) { ... } }, and this 
syntax does not allow for type inference on comparisons like ( 
int, uint ) without a cast or explicitly specifying the type, as 
such min!int( x, y ) (which of course, is not a problem when 
using a macro).

std.algorithm's already have more power min/max functions 
(variadic) so my take on this would be to use those instead, or 
implement a 2 parameter version of it for the windows header.

Cheers!

Phil


More information about the Digitalmars-d mailing list