Odin bindings for Dear ImGui v1.92.6-docking, generated via odin-c-bindgen on top of Dear Bindings — a C header generator that wraps the Dear ImGui C++ API into a clean C API (dcimgui.h / dcimgui_internal.h).
The generated Odin package lives in imgui/ under the package name ImGui.
- Full bindings for the public Dear ImGui API (
dcimgui.h) and internal API (dcimgui_internal.h) - Docking branch support (
IMGUI_HAS_DOCK) - Backend bindings for GLFW (platform) and Vulkan (renderer)
- Cross-platform: Windows, Linux, macOS, WASM
- Idiomatic Odin:
Im/ImGuiprefixes stripped, flag enums converted tobit_set, and many types remapped to native Odin equivalents including generic types such asVector,Span,Pool,ChunkStream, andStableVector
A recent Odin nightly is recommended.
The package links against several STB libraries that ship with Odin but must be compiled before first use:
make -C "<ODIN_ROOT>/vendor/stb/src"This produces stb_truetype, stb_rect_pack, and stb_sprintf — all required by Dear ImGui.
A compiled Dear ImGui static library must be present in the imgui/ folder. The expected file names are:
| OS | Architecture | File name |
|---|---|---|
| Windows | x64 | imgui_windows_x64.lib |
| Windows | arm64 | imgui_windows_arm64.lib |
| Linux | x64 | imgui_linux_x64.a |
| Linux | arm64 | imgui_linux_arm64.a |
| macOS | x64 | imgui_darwin_x64.a |
| macOS | arm64 | imgui_darwin_arm64.a |
A pre-built imgui_windows_x64.lib is included. For other platforms you will need to compile Dear ImGui yourself and place the resulting library in imgui/.
⚠️ imconfig.hmust match — see the Compiling the ImGui library section below.
Import the imgui/ directory as a package in your project:
import imgui "path/to/imgui"Backend bindings live in sub-packages:
| Backend | Sub-package path |
|---|---|
| GLFW | imgui/glfw |
| Vulkan | imgui/vulkan |
ImGui provides more example backends that haven't been included here. If you would like to rewrite one of these backends into Odin and add it to this binding feel free to create a PR.
When compiling Dear ImGui into a static library, you must compile it with the same imconfig.h that lives in headers/imconfig.h. This file controls compile-time options that affect data structure layouts and ABI. If the library is compiled with different settings than those used when the bindings were generated, you could get silent memory corruption or crashes at runtime.
The active non-default settings in headers/imconfig.h that are particularly important are:
| Define | Effect |
|---|---|
IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
Removes deprecated API — affects available symbols |
IMGUI_DISABLE_DEFAULT_ALLOCATORS |
Removes default malloc/free — you must call ImGui.SetAllocatorFunctions() |
IMGUI_USE_STB_SPRINTF |
Switches the internal formatter to stb_sprintf |
IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION |
Uses the external STB truetype library instead of the embedded copy |
IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION |
Uses the external STB rect_pack library instead of the embedded copy |
IMGUI_DISABLE_STB_SPRINTF_IMPLEMENTATION |
Uses the external STB sprintf library instead of the embedded copy |
IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS |
Links against imm32 on Windows for IME support |
The Odin bindings are generated from the C headers in headers/ using odin-c-bindgen, configured by the two SJSON files at the project root.
| Config file | Input header | Output |
|---|---|---|
dcimgui.sjson |
headers/dcimgui.h |
imgui/dcimgui.odin |
dcimgui_internal.sjson |
headers/dcimgui_internal.h |
imgui/dcimgui_internal.odin |
- Download the latest docking-branch C headers from the Dear Bindings releases page — grab the
AllBindingFiles.zipfor thedockingvariant. - Replace
headers/dcimgui.handheaders/dcimgui_internal.hwith the new files. - Review any changes to
imconfig.hin the new Dear ImGui release. If you need to updateheaders/imconfig.h, you must also recompile the Dear ImGui static library (see Compiling the ImGui library). - Recompile the Dear ImGui static library using the updated sources and the
headers/imconfig.hfrom this repo, then place the result inimgui/. - Re-run odin-c-bindgen with
dcimgui.sjsonanddcimgui_internal.sjson. - Review any new types, functions, or flags that may need to be added to the SJSON configs.
⚠️ Important — check the include indcimgui_internal.hAfter replacing
headers/dcimgui_internal.hwith a freshly downloaded file, open it and check whether it contains:#include "imgui.h"If it does, replace it with:
#include "dcimgui.h"The bindgen tool parses the C API headers, not the original C++ ones. Without this fix, parsing
dcimgui_internal.hwill produce errors.
- Dear ImGui — MIT license (see
backends/LICENSE.txt) - Dear Bindings — MIT license (see
headers/LICENSE.txt)