Bug 1663 – pragma(lib, "") don't work on linux

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
Linux
Creation time
2007-11-13T04:07:00Z
Last change time
2014-02-24T15:31:15Z
Keywords
link-failure
Assigned to
bugzilla
Creator
larsivar

Attachments

IDFilenameSummaryContent-TypeSize
243libpragma.patchpatch to use libfiles, disable pragma statementstext/plain1524

Comments

Comment #0 by larsivar — 2007-11-13T04:07:07Z
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.
Comment #1 by larsivar — 2007-11-13T17:36:10Z
Bill Baxter wrote: > [email protected] 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: [email protected] >> ReportedBy: [email protected] >> >> >> 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). > """ I know, but I'm after a solution that isn't tool dependent (and pragma (lib, "")) appears to be that solution.
Comment #2 by larsivar — 2007-11-24T07:12:45Z
See also Issue 1690. GDC has chosen to not implement pragma(lib) at all, at least not yet. This makes it a pretty useless thing to have in the spec. Either make it required, or remove it.
Comment #3 by bugs-d — 2008-04-12T18:39:01Z
Created attachment 243 patch to use libfiles, disable pragma statements This attachment makes two changes that make this pragma work properly: 1. Produces an error when used as a statement. The Windows compiler does not support this either, and it doesn't make sense anyway. 2. Adds "-lLIBRARY" to global.params.libfiles for each library on Linux. This way, it will be passed to gcc like any other (since I presume obj_includelib does not work with gcc on Linux.) I realize #1 isn't exactly this bug, but it is related to the pragma not working (on any OS) while being silently ignored. -[Unknown]
Comment #4 by bugzilla — 2008-12-08T00:53:43Z
Fixed in DMD 1.037 and 2.021