[Issue 1629] New: Link error: Previous Definition Different: blablah__initZ
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 31 01:02:36 PDT 2007
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 at digitalmars.com
ReportedBy: wbaxter at 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.
--
More information about the Digitalmars-d-bugs
mailing list