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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1663 - pragma(lib, "") don't work on linux
Summary: pragma(lib, "") don't work on linux
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: Other Linux
: P2 normal
Assignee: Walter Bright
URL:
Keywords: link-failure
Depends on:
Blocks:
Reported: 2007年11月13日 04:07 UTC by Lars Ivar Igesund
Modified: 2014年02月24日 15:31 UTC (History)
0 users

See Also:


Attachments
patch to use libfiles, disable pragma statements (1.49 KB, patch)
2008年04月12日 18:39 UTC, Unknown W. Brackets
Details | Diff
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Lars Ivar Igesund 2007年11月13日 04:07:07 UTC
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 Lars Ivar Igesund 2007年11月13日 17:36:10 UTC
Bill Baxter wrote:
> d-bugmail@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@digitalmars.com
>> ReportedBy: larsivar@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).
> """
I know, but I'm after a solution that isn't tool dependent (and pragma
(lib, "")) appears to be that solution.
Comment 2 Lars Ivar Igesund 2007年11月24日 07:12:45 UTC
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 Unknown W. Brackets 2008年04月12日 18:39:01 UTC
Created attachment 243 [details] 
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 Walter Bright 2008年12月08日 00:53:43 UTC
Fixed in DMD 1.037 and 2.021


AltStyle によって変換されたページ (->オリジナル) /