[Issue 1629] Link error: Previous Definition Different: blablah__initZ

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 19 06:35:22 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1629


matti.niemenmaa+dbugzilla at iki.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matti.niemenmaa+dbugzilla at ik
                   |                            |i.fi




------- Comment #3 from matti.niemenmaa+dbugzilla at 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.


-- 



More information about the Digitalmars-d-bugs mailing list