digitalmars.D.bugs - [Issue 1629] New: Link error: Previous Definition Different: blablah__initZ
- d-bugmail puremagic.com (69/69) Oct 31 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1629
- d-bugmail puremagic.com (6/6) Oct 31 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1629
- d-bugmail puremagic.com (8/8) Nov 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1629
- d-bugmail puremagic.com (45/45) Jul 19 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1629
- d-bugmail puremagic.com (9/9) Mar 11 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1629
- d-bugmail puremagic.com (10/10) Sep 04 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1629
http://d.puremagic.com/issues/show_bug.cgi?id=1629 Summary: Link error: Previous Definition Different: blablah__initZ Product: D Version: 1.022 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: wbaxter gmail.com The error seems to require a sort of a diamond pattern of imports. So it takes several files to get it to happen. Here's the minimal I've been able to get so far: ---link_main.d--- module link_main; import link_a; import link_b; link_a.Thing thinga; link_b.Thing thingb; void main() { } ---link_a.d--- module link_a; import link_common; alias link_common.CommonThing!() Thing; ---link_b.d--- module link_b; import link_common; alias link_common.CommonThing!() Thing; ---link_common.d--- module link_common; import link_default; struct CommonThing(T = DefaultT) { struct InnerT { alias DefaultT.Type Type; } const ConstValue = DefaultT.ConstValue; } ---link_default.d-- module link_default; struct DefaultT { alias float Type ; const uint ConstValue = 0; } --- Here's the exact compilation error: rebuild -oqobjs link_main f:\usr\pkg\d\dmd\bin\..\..\dm\bin\link.exe objs\_link_main+objs\_link_a+objs\_link_common+objs\_link_default+objs\_link_b,link_main.exe,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved objs\_link_b.obj(_link_b) Offset 001ADH Record Type 0091 Error 1: Previous Definition Different : _D11link_common17__T11CommonThingZ11CommonThing6InnerT6__initZ --- errorlevel 1 At least in my actual case where this came up I found I could make the problem go away if I created yet another module that link_a and link_b import that looks like: public import link_common; alias link_common.CommonThing!() Thing; This seems to clue the linker in that the two aliases are really instantiations of the same template. --
Oct 31 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1629 ------- Comment #1 from wbaxter gmail.com 2007-10-31 03:05 ------- Here's an NG post where I originally asked about this problem. http://www.digitalmars.com/d/archives/digitalmars/D/learn/about_dsss_and_blablablah_initZ_previous_definition_different_9247.html At the time I couldn't narrow it down to a small repro. --
Oct 31 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1629 ------- Comment #2 from wbaxter gmail.com 2007-11-03 23:47 ------- Note that the repro case uses 'rebuild' for compiling. It happens to use version 0.73, which has the compile-one-file-at-a-time behavior that Gregor put in to fix another linking error. The compilation works fine with dmd passing all files at once, the compiling separately one-at-a-time is what causes the failure. --
Nov 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1629 matti.niemenmaa+dbugzilla iki.fi changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matti.niemenmaa+dbugzilla ik | |i.fi ------- Comment #3 from matti.niemenmaa+dbugzilla iki.fi 2008-07-19 08:35 ------- Just ran into this with Tango's XML package (tango.text.xml.DocPrinter to be exact).This one's a bit different though, as one needs -inline and -release thrown to trigger it. Minimal testcase follows. Three files, no diamond pattern of imports, just a straight line: --------------------------- a.d: ---- module a; import b; void main() {} b.d --- module b; import c; // works - even fixes the error from below! // C!(int) x; // doesn't work void foo() { C!(int) x; } c.d --- module c; class C(T) { struct X {} } --------------------------- Compile separately and link: dmd -c a.d -inline -release dmd -c b.d -inline -release dmd -c c.d -inline -release dmd a.obj b.obj c.obj And get: OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. b.obj(b) Offset 0014EH Record Type 0091 Error 1: Previous Definition Different : _D1c8__T1CTiZ1C1X6__initZ --- errorlevel 1 Note the comment in b.d: adding an instantiation (or alias, thanks to the original reporter for that hint) at global scope fixes the problem. --
Jul 19 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1629 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #4 from bugzilla digitalmars.com 2009-03-11 14:51 ------- Fixed dmd 1.041 and 2.026 --
Mar 11 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1629 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |2korden gmail.com --- Comment #5 from Don <clugdbug yahoo.com.au> 2009-09-04 07:03:36 PDT --- *** Issue 2530 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 04 2009