Ok, but what's the intention behind defining GUIDs as enums in the first place ?
Why not defining them as const(GUID) and let the linker sort them out ?
Is there a recommended way to declare/define constants (e.g. as enums or consts) ?

In C (separate compilation) they are declared as "EXTERN_C const GUID"
and you use one C file to define this GUIDs for the Linker.

Thanks

-- KlausO

For the record, found two somehow related issues in bugzilla:

https://issues.dlang.org/show_bug.cgi?id=14309
https://issues.dlang.org/show_bug.cgi?id=4092


Am 09.03.2016 um 23:20 schrieb Ali Çehreli:
On 03/09/2016 10:35 AM, KlausO wrote:

 >          IUnknown pUnk;
 >
 >          //
 >          // Does not compile:
 >          //
 >          //  Error: function
 > core.sys.windows.unknwn.IUnknown.QueryInterface(const(GUID)* riid,
 > void** pvObject) is not callable using argument types (const(GUID),
void**)
 >          //
 >          hr = storage.QueryInterface(IID_IUnknown, cast(void**)&pUnk);

Without any experience with COM or (current) Windows programming, just
by looking at that error message, the following may work:

     IID unknown = IID_IUnknown;
     // (Apparently, IID is an alias for const(GUID).)

     storage.QueryInterface(&unknown, /* ... */);

Ali


Reply via email to