The generator currently brings over static inline functions as static functions. This isn't correct in this context since the functions don't actually have internal linkage since they're never defined.
A side-effect of this is that cimgui.cpp fails to build with GCC and Clang because the expansion of CIMGUI_API results in extern "C" static, which is results in two conflicting linkage specifications. (MSVC seems to just ignore the extern "C" which is also not correct in this case.)
The fix should be as simple as removing this line entirely:
It's not necessary to repeat extern "C" on every single function declaration when the header is wrapped in an extern "C" block. I also believe that specifying it on the declaration is enough, but you could wrap the cimgui.cpp implementations with an extern "C" block as well.
I also don't think it's correct to hard-code it here anyway since it prevents overriding CIMGUI_API to add __declspec on Windows.
The generator currently brings over
static inline
functions asstatic
functions. This isn't correct in this context since the functions don't actually have internal linkage since they're never defined.A side-effect of this is that
cimgui.cpp
fails to build with GCC and Clang because the expansion ofCIMGUI_API
results inextern "C" static
, which is results in two conflicting linkage specifications. (MSVC seems to just ignore theextern "C"
which is also not correct in this case.)The fix should be as simple as removing this line entirely:
https://github.com/dearimgui/dear_bindings/blob/11d93d51fa924400b0b4feb38d91e3181c4d8ee9/src/templates/imgui-header.cpp#L7
It's not necessary to repeat
extern "C"
on every single function declaration when the header is wrapped in anextern "C"
block. I also believe that specifying it on the declaration is enough, but you could wrap thecimgui.cpp
implementations with anextern "C"
block as well.I also don't think it's correct to hard-code it here anyway since it prevents overriding
CIMGUI_API
to add__declspec
on Windows.