What's up with the windows headers?
Phil Lavoie
maidenphil at hotmail.com
Thu Dec 27 10:41:15 PST 2012
Hi,
I am currently using the win32 api bindings project and things
went rather smoothly in migrating my (not so big) code (so far).
I love that pragmas are everywhere to make the compiler link to
proper libraries.
Also, the windows lib included in the distribution of dmd lacks
the "version" import library, so I had to hand make it, but that
should not be the case for a out-of-the-box-ready-compiler, so we
should keep that in mind.
I am willing to help out but at the same time I am really not
that savvy about Windows system. I will get as savvy as
Programming Windows will get me though.
So far, I had to modify some code because windows functions
should be marked as nothrow. Otherwise, they are to be placed in
try catch blocks in a win-proc (which has to be nothrow I
believe). So I adjusted those I used (but they usually are in
"extern(Windows)" blocks so I just added "nothrow" to those,
correcting a whole bunch of functions at the same time).
There will be some minor changes I think. Like removing the min
and max templates or just implement them in an other way. See why:
current impl:
template max(T) {
T max(T a, T b) {
return a > b ? a : b;
}
}
template min(T) {
T min(T a, T b) {
return a < b ? a : b;
}
}
Supposed to replace a macro, but no type inference make it a
hassle to use (must say min!int( 1, 2 ) for example instead of
just min(1,2). We could change it to type inferring functions,
but that already has been done in std.algorithm, plus theirs is
more powerful (variadic functions). This is just one example but
I am guessing I will find others (and not all) through my
experimentations on the Windows system.
I too believe that the whole win32 api headers should be included
in the distribution, as well as well as any other system
supported. Though, there could be some kind of package downloads
to prevent the installation of unused headers. In any case, I
think it would be nice if AT LEAST the installation platform's
headers were all with the product. Others could be fetched on
demand on this website for example.
Phil
More information about the Digitalmars-d
mailing list