Issue 4295 - IID_IUnknown symbol undefined in phobos.lib
Summary: IID_IUnknown symbol undefined in phobos.lib
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: link-failure, rejects-valid, spec
Depends on:
Blocks:
 
Reported: 2010-06-08 10:24 UTC by Trass3r
Modified: 2014-02-15 02:43 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Trass3r 2010-06-08 10:24:18 UTC
std.c.windows.windows defines extern IID IID_IUnknown (and later uses it in ComObject)
but the linker complains that the symbol is undefined.

Replacing it with

IID IID_IUnknown = {0x00000000, 0x0000, 0x0000, [0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46]};

makes it work, but I'm not sure if this is the correct GUID.
Comment 1 Rainer Schuetze 2010-06-08 11:04:02 UTC
You need to link against uuid.lib to resolve the symbol. 

I don't think it is possible to add a pragma(lib,"uuid") upon usage, so this should be mentioned somewhere (maybe http://www.digitalmars.com/d/2.0/COM.html).
Comment 2 Trass3r 2010-06-08 11:28:05 UTC
Ah thanks. Then it should be fixed in the docs.
Also at http://digitalmars.com/d/2.0/dll.html#com
Comment 3 Trass3r 2010-06-08 11:30:20 UTC
Just found out that pragma(lib, "uuid") is actually present in std.windows.iunknown!

But this one is more or less obsolete.
std.c.windows.com contains more functionality and also the ComObject class that is mentioned in the docs IIRC.
Comment 4 Walter Bright 2010-09-27 19:53:52 UTC
#pragma(lib, "uuid") is already present in std.c.windows.com.

So, I need an example of code where the link is failing due to not linking against uuid.lib.
Comment 5 Rainer Schuetze 2010-09-27 23:05:55 UTC
The pragma was added by Andrei in the meantime, so you might consider it fixed.

Please consider deprecating/removing std.windows.iunknown, because it only duplicates part of the code in std.c.windows.com which can lead to confusion.
Comment 6 Andrej Mitrovic 2011-05-24 21:01:55 UTC
If it's fixed, we shall close it. :)
Comment 7 Trass3r 2011-05-25 06:29:08 UTC
It isn't fixed, std.windows.iunknown is still present.
Comment 8 Andrej Mitrovic 2011-05-25 07:23:16 UTC
Okie no more monkey-business from me.
Comment 9 github-bugzilla 2012-01-23 18:05:47 UTC
Commit pushed to https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/5ad3dafd10002983fe92907c14ff5e8322c22d86
fix Issue 4295 - IID_IUnknown symbol undefined in phobos.lib