dearimgui / dear_bindings

C header (and language binding metadata) generator for Dear ImGui
MIT License
221 stars 12 forks source link

`cimgui.h` should handle inclusion from C++ #17

Closed PathogenDavid closed 2 years ago

PathogenDavid commented 2 years ago

(I initially mentioned this here: https://github.com/dearimgui/dear_bindings/issues/13#issuecomment-902662605)

Even though C++ users shouldn't really generally be using cimgui.h, it should include an extern "C" block when it's built as C++ to ensure linking happens correctly. IE:

#ifndef IMGUI_H

#ifdef __cplusplus
extern "C"
{
#endif

// dear imgui, v1.84 WIP
// ...header contents goes here...

#ifdef __cplusplus
}
#endif
#endif

After this change, the explicit extern "C" block in the generated cimgui.cpp can be removed.

ShironekoBen commented 2 years ago

Very good idea - I've added support for that and removed the block from cimgui.cpp. 7e3cd50a39805022e09e7d379b80ac966ff667f9