Bug 14309 – The difference between Microsoft's GUID and std.uuid.UUID

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2015-03-19T10:36:31Z
Last change time
2024-12-01T16:24:04Z
Assigned to
No Owner
Creator
SHOO
Moved to GitHub: phobos#10120 →

Comments

Comment #0 by zan77137 — 2015-03-19T10:36:31Z
In following code, I think it is hoped that `id` is the same as `IID_IClassFactory`, why does this happen? -------------- import std.stdio, core.sys.windows.com, std.uuid; pragma(lib, "uuid"); // for IID_IClassFactory void main() { // IID of IClassFactory // https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.ole.interop.iclassfactory.aspx immutable id = UUID("00000001-0000-0000-C000-000000000046"); static assert(UUID.sizeof == 16); static assert(IID_IClassFactory.sizeof == 16); // 01 00 00 00 00 00 00 00 C0 00 00 00 00 00 00 46 writefln("IID_IClassFactory: %(%02X %)", *cast(ubyte[16]*)&IID_IClassFactory); // 00 00 00 01 00 00 00 00 C0 00 00 00 00 00 00 46 writefln("std.uuid.UUID: %(%02X %)", id.data); assert(id.data == *cast(ubyte[16]*)&IID_IClassFactory); // failure assert(UUID("01000000-0000-0000-C000-000000000046").data == *cast(ubyte[16]*)&IID_IClassFactory); // success }
Comment #1 by dfj1esp02 — 2015-03-19T14:07:37Z
UUID is big endian, GUID is little endian, hence mismatch.
Comment #2 by robert.schadek — 2024-12-01T16:24:04Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10120 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB