ImportC GUID compilation problem with some Windows headers

Carl Sturtivant sturtivant at gmail.com
Thu Mar 21 00:06:56 UTC 2024


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.
```C
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.


More information about the Digitalmars-d-learn mailing list