Thread overview
ImportC GUID compilation problem with some Windows headers
Mar 21
Dave P.
March 21

I'm running into this COM related issue with some Windows headers, in the case when each GUID is declared in such a file as follows.

EXTERN_GUID(IID_IBlahBlahBlah, 0xabcdef12, 0x11d2, 0xab3a, 0xc0, 0x4f, [...] );

and ImportC which is compiling blah.c containing only a few macro definitions and a single include of a header file say <blah.h> encounters these and responds with

[...] waffle.h(123): Error: variable `waffle.IID_IBlahBlahBlah` extern symbols cannot have initializers

Presumably MSVC simply compiles such files, but DMD's ImportC is too strict to do so. I've worked around this in some very dirty and inconvenient ways, but am hoping for a real solution of some kind. I want to use some of these IIDs and CLSIDs so I need to make these declarations work in some fashion. Inclusions are nested so these may be far from the header file I am including in blah.c. Any help appreciated.

March 21

On Thursday, 21 March 2024 at 00:06:56 UTC, Carl Sturtivant wrote:

>
EXTERN_GUID(IID_IBlahBlahBlah, 0xabcdef12, 0x11d2, 0xab3a, 0xc0, 0x4f, [...] );

Has anyone successfully compiled an EXTERN_GUID declaration like this in a Windows header with ImportC using some C macro trickery for example?

March 21

On Thursday, 21 March 2024 at 18:19:58 UTC, Carl Sturtivant wrote:

>

On Thursday, 21 March 2024 at 00:06:56 UTC, Carl Sturtivant wrote:

>
EXTERN_GUID(IID_IBlahBlahBlah, 0xabcdef12, 0x11d2, 0xab3a, 0xc0, 0x4f, [...] );

Has anyone successfully compiled an EXTERN_GUID declaration like this in a Windows header with ImportC using some C macro trickery for example?

I filed a bug for this: https://issues.dlang.org/show_bug.cgi?id=24447

I haven’t tried on a windows box and this is just from me grepping through header files, but maybe try to #define EXTERN_C as nothing in the meantime?

March 21

On Thursday, 21 March 2024 at 22:33:17 UTC, Dave P. wrote:

>

I filed a bug for this: https://issues.dlang.org/show_bug.cgi?id=24447

I haven’t tried on a windows box and this is just from me grepping through header files, but maybe try to #define EXTERN_C as nothing in the meantime?

I'll give it a shot. Thanks for the bug report.