www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1663] New: pragma(lib, "") don't work on linux

reply d-bugmail puremagic.com writes:
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.


-- 
Nov 13 2007
next sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
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). """
Nov 13 2007
parent Lars Ivar Igesund <larsivar igesund.net> writes:
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.
Nov 13 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1663





------- Comment #2 from larsivar igesund.net  2007-11-24 07:12 -------
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.


-- 
Nov 24 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1663





------- Comment #3 from unknown simplemachines.org  2008-04-12 18:39 -------
Created an attachment (id=243)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=243&action=view)
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]


-- 
Apr 12 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1663


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #4 from bugzilla digitalmars.com  2008-12-08 00:53 -------
Fixed in DMD 1.037 and 2.021


-- 
Dec 07 2008