Thread overview
[Issue 10386] New: Package import feature breaks with static libraries
Jun 17, 2013
Andrej Mitrovic
Jun 17, 2013
Andrej Mitrovic
Jun 17, 2013
Andrej Mitrovic
Jun 18, 2013
Walter Bright
Jun 18, 2013
Andrej Mitrovic
Jun 18, 2013
Martin Nowak
Jun 18, 2013
Andrej Mitrovic
Jun 20, 2013
Kenji Hara
Jun 20, 2013
yebblies
June 17, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10386

           Summary: Package import feature breaks with static libraries
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: link-failure
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-06-16 17:06:36 PDT ---
Created an attachment (id=1227)
testcase

See the attached test-case and run build.bat to reproduce.

Note that using a regular module import in the client code works, but using the package import triggers linker errors.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 17, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10386



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-06-16 17:06:58 PDT ---
The linker error:

> Error 42: Symbol Undefined _D3foo3bar3fooFiZv

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 17, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10386



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-06-16 17:07:41 PDT ---
Using latest git-head version of DMD.

I've only verified this on Windows, but the test-case is simple enough for people to test it on Posix.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10386


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2013-06-17 17:51:38 PDT ---
For tiny files like that, it's a lot more user-friendly to just put the text of them in a comment. Otherwise, only a small fraction of people will look at it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10386



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-06-17 17:55:39 PDT ---
(In reply to comment #3)
> For tiny files like that, it's a lot more user-friendly to just put the text of them in a comment. Otherwise, only a small fraction of people will look at it.

The reason I zipped it is because it has a directory structure, which is always painful to recreate manually. Here's the zip contents anyway:

./test.d:

-----
module test;

// import lib.foo.bar;  // ok
import lib.foo;  // linker failure

void main()
{
    foo(1);
}
-----

./lib/foo/bar.d
-----
module lib.foo.bar;

void foo(int x)
{
    assert(x == 1);
}
-----

./lib/foo/package.d
-----
module lib.foo;

public import lib.foo.bar;
-----

On Windows compile with:
$ dmd -lib lib\foo\bar.d lib\foo\package.d -offoo.lib
$ dmd test.d foo.lib

On Posix it's probably:

$ dmd -lib lib/foo/bar.d lib/foo/package.d -oflibfoo.a
$ dmd test.d -L-lfoo

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10386


Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@dawg.eu


--- Comment #5 from Martin Nowak <code@dawg.eu> 2013-06-18 01:10:19 PDT ---
(In reply to comment #1)
> The linker error:
> 
> > Error 42: Symbol Undefined _D3foo3bar3fooFiZv

Looks like the mangling is wrong. It should be _D3lib3foo3bar3fooFiZv right?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10386



--- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-06-18 06:23:12 PDT ---
(In reply to comment #5)
> (In reply to comment #1)
> > The linker error:
> > 
> > > Error 42: Symbol Undefined _D3foo3bar3fooFiZv
> 
> Looks like the mangling is wrong. It should be _D3lib3foo3bar3fooFiZv right?

Yeah I think so.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10386


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #7 from Kenji Hara <k.hara.pg@gmail.com> 2013-06-19 22:10:07 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2229

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10386



--- Comment #8 from github-bugzilla@puremagic.com 2013-06-20 04:03:30 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4ddfbcb9aee814cddc82939ecd37928059f3e670 fix Issue 10386 - Package import feature breaks with static libraries

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10386


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------