What's up with the windows headers?

Stewart Gordon smjg_1998 at yahoo.com
Thu Dec 27 11:13:11 PST 2012


On 27/12/2012 18:41, Phil Lavoie wrote:
> 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.

Yes, the .lib files that ship with DMD are out of date.  It's a known issue.
http://d.puremagic.com/issues/show_bug.cgi?id=6625

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

OK.  Have you had a good look at the translation instructions? 
Downloaded the latest MinGW headers?  Got Subversion installed?  Let me 
know if you get stuck somewhere along the line.

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

I guess most of us haven't been using the nothrow attribute much and so 
hadn't noticed it.  Good catch.

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

IFTI should work perfectly on these.  If it doesn't, you have a buggy 
compiler.  What compiler version are you using, and what error message 
do you get when you try using just min(1,2)?

Stewart.


More information about the Digitalmars-d mailing list