From 7f8d05101e96c64314d7926c80ee157dcb89da4e Mon Sep 17 00:00:00 2001 From: paoda Date: Mon, 9 Sep 2024 02:09:35 -0500 Subject: [PATCH] fix: expose Imgui API as extern "C" to satisfy ld --- libs/imgui/backends/imgui_impl_sdl2.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libs/imgui/backends/imgui_impl_sdl2.h b/libs/imgui/backends/imgui_impl_sdl2.h index e551e52..f60543f 100644 --- a/libs/imgui/backends/imgui_impl_sdl2.h +++ b/libs/imgui/backends/imgui_impl_sdl2.h @@ -27,20 +27,24 @@ struct SDL_Renderer; struct _SDL_GameController; typedef union SDL_Event SDL_Event; -// Follow "Getting Started" link and check examples/ folder to learn about using backends! -IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); -IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); -IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window); -IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window); -IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForSDLRenderer(SDL_Window* window, SDL_Renderer* renderer); -IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOther(SDL_Window* window); -IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); -IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(); -IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event); +// FIX(paoda) +extern "C" { + // Follow "Getting Started" link and check examples/ folder to learn about using backends! + IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); + IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); + IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window); + IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window); + IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForSDLRenderer(SDL_Window* window, SDL_Renderer* renderer); + IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOther(SDL_Window* window); + IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); + IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(); + IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event); +} // Gamepad selection automatically starts in AutoFirst mode, picking first available SDL_Gamepad. You may override this. // When using manual mode, caller is responsible for opening/closing gamepad. enum ImGui_ImplSDL2_GamepadMode { ImGui_ImplSDL2_GamepadMode_AutoFirst, ImGui_ImplSDL2_GamepadMode_AutoAll, ImGui_ImplSDL2_GamepadMode_Manual }; -IMGUI_IMPL_API void ImGui_ImplSDL2_SetGamepadMode(ImGui_ImplSDL2_GamepadMode mode, struct _SDL_GameController** manual_gamepads_array = NULL, int manual_gamepads_count = -1); +// FIX(padoa) +extern "C" IMGUI_IMPL_API void ImGui_ImplSDL2_SetGamepadMode(ImGui_ImplSDL2_GamepadMode mode, struct _SDL_GameController** manual_gamepads_array = NULL, int manual_gamepads_count = -1); #endif // #ifndef IMGUI_DISABLE