diff --git a/source/bridges-ui/CarlaBridgeToolkitGtk.cpp b/source/bridges-ui/CarlaBridgeToolkitGtk.cpp index ec440d932..786f88164 100644 --- a/source/bridges-ui/CarlaBridgeToolkitGtk.cpp +++ b/source/bridges-ui/CarlaBridgeToolkitGtk.cpp @@ -68,8 +68,12 @@ CARLA_BRIDGE_UI_START_NAMESPACE struct GtkLoader { lib_t lib; - gsym_signal_connect_data signal_connect_data; +#ifdef CARLA_OS_WIN + lib_t glib; + lib_t golib; +#endif gsym_timeout_add timeout_add; + gsym_signal_connect_data signal_connect_data; gtksym_init init; gtksym_main main; gtksym_main_level main_level; @@ -100,8 +104,12 @@ struct GtkLoader { GtkLoader() : lib(nullptr), - signal_connect_data(nullptr), +#ifdef CARLA_OS_WIN + glib(nullptr), + golib(nullptr), +#endif timeout_add(nullptr), + signal_connect_data(nullptr), init(nullptr), main(nullptr), main_level(nullptr), @@ -134,6 +142,8 @@ struct GtkLoader { #ifdef BRIDGE_GTK3 # if defined(CARLA_OS_MAC) "libgtk-3.0.dylib", +# elif defined(CARLA_OS_WIN) + "libgtk-3-0.dll", # else "libgtk-3.so.0", # endif @@ -144,6 +154,13 @@ struct GtkLoader { "/opt/homebrew/opt/gtk+/lib/libgtk-quartz-2.0.0.dylib", "/opt/local/lib/libgtk-quartz-2.0.dylib", "/opt/local/lib/libgtk-x11-2.0.dylib", +# elif defined(CARLA_OS_WIN) + "libgtk-win32-2.0-0.dll", +# ifdef CARLA_OS_WIN64 + "C:\\msys64\\mingw64\\bin\\libgtk-win32-2.0-0.dll", +# else + "C:\\msys64\\mingw32\\bin\\libgtk-win32-2.0-0.dll", +# endif # else "libgtk-x11-2.0.so.0", # endif @@ -167,10 +184,76 @@ struct GtkLoader { fprintf(stdout, "%s loaded successfully!\n", filename); } +#ifdef CARLA_OS_WIN + const char* gfilename; + const char* const gfilenames[] = { + "libglib-2.0-0.dll", +# ifdef CARLA_OS_WIN64 + "C:\\msys64\\mingw64\\bin\\libglib-2.0-0.dll", +# else + "C:\\msys64\\mingw32\\bin\\libglib-2.0-0.dll", +# endif + }; + + for (size_t i=0; i(glib, "g_" #NAME); \ + CARLA_SAFE_ASSERT_RETURN(NAME != nullptr,); + + #define GO_LIB_SYMBOL(NAME) \ + NAME = lib_symbol(golib, "g_" #NAME); \ + CARLA_SAFE_ASSERT_RETURN(NAME != nullptr,); +#else #define G_LIB_SYMBOL(NAME) \ NAME = lib_symbol(lib, "g_" #NAME); \ CARLA_SAFE_ASSERT_RETURN(NAME != nullptr,); + #define GO_LIB_SYMBOL G_LIB_SYMBOL +#endif + #define GTK_LIB_SYMBOL(NAME) \ NAME = lib_symbol(lib, "gtk_" #NAME); \ CARLA_SAFE_ASSERT_RETURN(NAME != nullptr,); @@ -179,8 +262,8 @@ struct GtkLoader { NAME = lib_symbol(lib, "gdk_" #NAME); \ CARLA_SAFE_ASSERT(NAME != nullptr); - G_LIB_SYMBOL(signal_connect_data) G_LIB_SYMBOL(timeout_add) + GO_LIB_SYMBOL(signal_connect_data) GTK_LIB_SYMBOL(init) GTK_LIB_SYMBOL(main) @@ -211,6 +294,8 @@ struct GtkLoader { # endif #endif + #undef G_LIB_SYMBOL + #undef GO_LIB_SYMBOL #undef GDK_LIB_SYMBOL #undef GTK_LIB_SYMBOL } @@ -219,6 +304,12 @@ struct GtkLoader { { if (lib != nullptr) lib_close(lib); +#ifdef CARLA_OS_WIN + if (golib != nullptr) + lib_close(golib); + if (glib != nullptr) + lib_close(glib); +#endif } void main_quit_if_needed()