[Issue 1663] New: pragma(lib, "") don't work on linux

Bill Baxter dnewsgroup at billbaxter.com
Tue Nov 13 15:25:11 PST 2007


d-bugmail at puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=1663
> 
>            Summary: pragma(lib, "") don't work on linux
>            Product: D
>            Version: 1.023
>           Platform: Other
>         OS/Version: Linux
>             Status: NEW
>           Severity: normal
>           Priority: P2
>          Component: DMD
>         AssignedTo: bugzilla at digitalmars.com
>         ReportedBy: larsivar at igesund.net
> 
> 
> pragma (lib, "") doesn't work on linux.
> 
> I would expect for instance
> 
> pragma (lib, "dl") to make libdl be linked in, aka -ldl
> 
> There is nothing in the docs about this not working on Linux. I also think it
> is a silly feature to have as optional for implementations.

dsss implements a pragma(link,...) which does basically that.
It's really what pragma(lib,...) should have been to begin with.

From
http://svn.dsource.org/projects/dsss/trunk/docs/README.software_engineers
"""
The -ll flag is only useful for explicitly linking libraries into 
binaries. If the DSSS-implemented library depends on a non-DSSS library, 
the dependency must be specified in a .d file which is part of the 
DSSS-implemented library. This is done with the 'link' pragma, which 
must always be specified within version(build):

version (build) {
     pragma(link, "example");
}

The above example will cause any binary linked against the 
DSSS-implemented library to link against the library named libexample.a 
(or example.lib on Windows).
"""


More information about the Digitalmars-d-bugs mailing list