Thread overview
Why do the WindowsAPI bindings have pragma calls?
Apr 08, 2011
Andrej Mitrovic
Apr 08, 2011
Andrej Mitrovic
Apr 10, 2011
Jacob Carlborg
Apr 10, 2011
Andrej Mitrovic
Apr 11, 2011
Jacob Carlborg
April 08, 2011
E.g. the WindowsAPI bindings have the wingdi.d file, which has this call at the very top of the module:

pragma(lib, "gdi32.lib");

This doesn't seem to put any gdi32.lib symbol references to the final winapi library file, and if I try to use a function from wingdi.d from a main file, I still have to manually link to the gdi32.lib file (or use a pragma), otherwise I get undefined symbol errors.

So what are those pragmas for?
April 08, 2011
Ok so if I compile the Winapi .d modules with my main file, the pragma statement is taken into account and I don't have to manually add the pragma again.

But If I use an import switch (dmd -Iwin32\) and a precompiled library, then the pragma statement is skipped. Could this be considered a bug?
April 10, 2011
On 2011-04-08 21:18, Andrej Mitrovic wrote:
> Ok so if I compile the Winapi .d modules with my main file, the pragma
> statement is taken into account and I don't have to manually add the
> pragma again.
>
> But If I use an import switch (dmd -Iwin32\) and a precompiled
> library, then the pragma statement is skipped. Could this be
> considered a bug?

http://d.puremagic.com/issues/show_bug.cgi?id=2776

-- 
/Jacob Carlborg
April 10, 2011
Damn, a two year old patch. Why wasn't this included already?

Thanks for letting me know.
April 11, 2011
On 2011-04-10 20:24, Andrej Mitrovic wrote:
> Damn, a two year old patch. Why wasn't this included already?
>
> Thanks for letting me know.

There are a lot of those in bugzilla.

-- 
/Jacob Carlborg