Bug 15482 – new uuid.d forbids to link statically with other libraries
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2015-12-29T13:56:22Z
Last change time
2018-01-28T16:33:13Z
Assigned to
No Owner
Creator
Temtaime
Comments
Comment #0 by temtaime — 2015-12-29T13:56:22Z
phobos_x64.lib(uuid.obj) : error LNK2005: CLSID_DirectInput already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: CLSID_DirectInputDevice already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_Button already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_ConstantForce already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_CustomForce already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_Damper already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_1394 already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_1394DEBUG already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_61883 already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_ADAPTER already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_APMSUPPORT already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_AVC already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_BATTERY already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_BLUETOOTH already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_CDROM already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_COMPUTER already defined in sdl_x64.lib(SDL_dxjoystick.obj)
phobos_x64.lib(uuid.obj) : error LNK2005: GUID_DEVCLASS_DECODER already defined in sdl_x64.lib(SDL_dxjoystick.obj)
And so on.
Why we ever export uuids from uuid.d ?
There's a little incompatibility here: mssdk provides these guids in a static library and declares them as extern in headers, but gnu toolchain can't handle this scenario gracefully and would link all guids into executable, hence mingw headers declare guids as static (hidden in C) and doesn't provide static library with them. To use mssdk library and declare guids as extern, write
extern extern(C) immutable IID GUID_Button;
(without initializer) instead of what currently is in uuid.d
Turns out the symbols are in druntime (I also couldn't find them in phobos!).
druntime also has a uuid.d file, so the same object filename, and the symbols are in there. It seems that druntime and phobos are aggregated into one lib? Weird, but okay...
Anyway... I'm not entirely sure these symbols should be in druntime. Why are they there? Why can't users just link the usual libs that supple them? Those libs are now mutually exclusive with phobos, and that's a big problem.
Comment #5 by code — 2016-10-20T12:49:22Z
(In reply to Manu from comment #4)
It's probably just a mistake from adding the Windows headers.
Comment #6 by turkeyman — 2016-10-20T12:52:11Z
Okay... so, extern to them and remove the definitions in druntime?
Comment #7 by temtaime — 2017-06-25T21:04:11Z
Yes, do it
Comment #8 by dlang-bugzilla — 2017-06-26T10:30:26Z
Why not just remove the export or extern(C) annotations in core.sys.windows.uuid?
Comment #9 by github-bugzilla — 2018-01-28T16:33:12Z