Skip to content

Instantly share code, notes, and snippets.

@Nenkai
Last active July 7, 2025 21:03
Show Gist options
  • Save Nenkai/7b0e3d8079118149c3d483804414e0fb to your computer and use it in GitHub Desktop.
Save Nenkai/7b0e3d8079118149c3d483804414e0fb to your computer and use it in GitHub Desktop.

C Bindings

  1. Clone imgui to own folder, specific tag.
  2. Clone dear-bindings to own folder, NEXT TO imgui. Important!
  3. Install python/requirements for dear-bindings
  4. Run BuildAllBindings.bat
  5. Edit examples/ImGuiLib
  6. Install vcpkg, ImGuiLib properties > vcpkg -> Use Vcpkg Manifest should be on Yes
  7. When compiling with Win32, Add a source file to the source folder. It should have:
  8. (Hack) remove extern in dcimgui_impl_win32.h such that it looks like this:
CIMGUI_IMPL_API LRESULT cImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
  1. Compile.

C# Bindings

  1. Install ClangSharpPInvokeGenerator with dotnet tool install --global ClangSharpPInvokeGenerator --version 20.1.2
  2. Run generate_dotnet_bindings.bat.

Note

You may also need to add #include <Windows.h> above CIMGUI_IMPL_API LRESULT cImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); temporarily in dcimgui_impl_win32.h

And #include <d3d11.h> to dcimgui_impl_dx11.h so that the bindings generation works.

You may also need to adjust hardcoded paths I left in for plutosvg because I couldn't get Visual Studio/vcpkg to detect plutosvg as it should

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment