www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Why do the WindowsAPI bindings have pragma calls?

reply Andrej Mitrovic <none none.none> writes:
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?
Apr 08 2011
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
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?
Apr 08 2011
parent reply Jacob Carlborg <doob me.com> writes:
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
Apr 10 2011
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Damn, a two year old patch. Why wasn't this included already?

Thanks for letting me know.
Apr 10 2011
parent Jacob Carlborg <doob me.com> writes:
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
Apr 10 2011