MCPcopy Create free account
hub / github.com/bluescan/tacentview / DebugCheckVersionAndDataLayout

Method DebugCheckVersionAndDataLayout

Contrib/imgui/imgui.cpp:8883–8894  ·  view source on GitHub ↗

Helper function to verify ABI compatibility between caller code and compiled version of Dear ImGui. Verify that the type sizes are matching between the calling file's compilation unit and imgui.cpp's compilation unit If this triggers you have an issue: - Most commonly: mismatched headers and compiled code version. - Or: mismatched configuration #define, compilation settings, packing pragma etc. Th

Source from the content-addressed store, hash-verified

8881// which is way it is required you put them in your imconfig file (and not just before including imgui.h).
8882// Otherwise it is possible that different compilation units would see different structure layout
8883bool ImGui::DebugCheckVersionAndDataLayout(const char* version, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_vert, size_t sz_idx)
8884{
8885 bool error = false;
8886 if (strcmp(version, IMGUI_VERSION) != 0) { error = true; IM_ASSERT(strcmp(version, IMGUI_VERSION) == 0 && "Mismatched version string!"); }
8887 if (sz_io != sizeof(ImGuiIO)) { error = true; IM_ASSERT(sz_io == sizeof(ImGuiIO) && "Mismatched struct layout!"); }
8888 if (sz_style != sizeof(ImGuiStyle)) { error = true; IM_ASSERT(sz_style == sizeof(ImGuiStyle) && "Mismatched struct layout!"); }
8889 if (sz_vec2 != sizeof(ImVec2)) { error = true; IM_ASSERT(sz_vec2 == sizeof(ImVec2) && "Mismatched struct layout!"); }
8890 if (sz_vec4 != sizeof(ImVec4)) { error = true; IM_ASSERT(sz_vec4 == sizeof(ImVec4) && "Mismatched struct layout!"); }
8891 if (sz_vert != sizeof(ImDrawVert)) { error = true; IM_ASSERT(sz_vert == sizeof(ImDrawVert) && "Mismatched struct layout!"); }
8892 if (sz_idx != sizeof(ImDrawIdx)) { error = true; IM_ASSERT(sz_idx == sizeof(ImDrawIdx) && "Mismatched struct layout!"); }
8893 return !error;
8894}
8895
8896// Until 1.89 (IMGUI_VERSION_NUM < 18814) it was legal to use SetCursorPos() to extend the boundary of a parent (e.g. window or table cell)
8897// This is causing issues and ambiguity and we need to retire that.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected