Other

digitalmars.D.learn - Very strange linker error

I'm trying to rebuild my projects with new dmd and after fixing some
minor issues in my code I get the following:
Warning: As of Phobos 2.054, std.file.listDir has been scheduled for
deprecation in August 2011. Please use std.file.dirEntries instead.
OPTLINK (R) for Win32 Release 8.00.12
Copyright (C) Digital Mars 1989-2010 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
obj\main.obj(main) Offset 35B56H Record Type 00C3
Error 1: Previous Definition Different : _D5mysdl5input8Joystick6__ctorM
--- errorlevel 1
So I went to http://www.digitalmars.com/d/2.0/abi.html (which I by the
wy couldn't find on d-p-l.org) and it seems to be an incorrect mangling
because there's no 'type' after M but maybe it's a special case for the
constructor.
So looked for mysdl.input.Joystick.this(...). The struct (!) Joystick in
input.d has two constructors:
public this(SDL_Joystick* somePtr) {
this.joyptr = somePtr;
}
public this(int index)
in {
assert(index >= 0);
assert(index < Joystick.getCount());
} body {
this(SDL_JoystickOpen(index));
}
No overlaping. So I went dumping all my object files and I found that
dmd generated this strange sambol in input.obj twice. So it's not
optlink's fault but dmd's!
I'd really like to solve this problem because otherwise this would be
second release in a row that I can't use.
The worst thing is I don't even now any ugly workaround. :(
Mafi

I'm trying to rebuild my projects with new dmd and after fixing some
minor issues in my code I get the following:
Warning: As of Phobos 2.054, std.file.listDir has been scheduled for
deprecation in August 2011. Please use std.file.dirEntries instead.
OPTLINK (R) for Win32 Release 8.00.12
Copyright (C) Digital Mars 1989-2010 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
obj\main.obj(main) Offset 35B56H Record Type 00C3
Error 1: Previous Definition Different : _D5mysdl5input8Joystick6__ctorM
--- errorlevel 1
So I went to http://www.digitalmars.com/d/2.0/abi.html (which I by the
wy couldn't find on d-p-l.org) and it seems to be an incorrect mangling
because there's no 'type' after M but maybe it's a special case for the
constructor.
So looked for mysdl.input.Joystick.this(...). The struct (!) Joystick in
input.d has two constructors:
public this(SDL_Joystick* somePtr) {
this.joyptr = somePtr;
}
public this(int index)
in {
assert(index >= 0);
assert(index < Joystick.getCount());
} body {
this(SDL_JoystickOpen(index));
}
No overlaping. So I went dumping all my object files and I found that
dmd generated this strange sambol in input.obj twice. So it's not
optlink's fault but dmd's!
I'd really like to solve this problem because otherwise this would be
second release in a row that I can't use.
The worst thing is I don't even now any ugly workaround. :(
Mafi

I commented out the first contructor and inlined it into the other: no
linker errors.
But it used to compile with two constructors. If it's ok that it does
not compile, the compiler should catch it and not the linker IMO.
Is it a bug in the compiler??
Mafi