Comments on pragma(lib,...)

Sean Kelly sean at
Sun Jun 4 12:23:43 PDT 2006

The way I typically use pragma(lib,...) in C++ is to add these statements to
header files of library code so 
the appropriate library file is linked (single/multithreaded, debug/release,
static/dll, etc) along with any 
dependencies.  I had planned to use pragma(lib,...) in the same way in D until I
discovered that, like 
"version," the pragma is ignored outside of the module it's declared in.  The
obvious consequence is that 
any module containing such pragmas must be compiled and linked into the
application for the pragmas to 
have any effect.  And while I can appreciate the simplicity of such a design, it
dramatically reduces the 
utility of this feature for me.  Is there any chance that pragma(lib,...) could
be made "viral" so it can be 
used in header (.di) files?  Between this and template symbol issues I'll admit
to being a bit frustrated by 
traditional library design in D.  I'm beginning to think that Build is more of
an appropriate D-oriented 
solution.  However, there are still a few instances where I need to use more
traditionally designed libraries.


More information about the Digitalmars-d mailing list