diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c index 5efdde9e8f..b368af092c 100644 --- a/app/plug-in/gimpplugin.c +++ b/app/plug-in/gimpplugin.c @@ -108,6 +108,9 @@ static gboolean gimp_plug_in_flush (GIOChannel *channel, static gboolean gimp_plug_in_recv_message (GIOChannel *channel, GIOCondition cond, gpointer data); +#if defined G_OS_WIN32 && defined WIN32_32BIT_DLL_FOLDER +static void gimp_plug_in_set_dll_directory (const gchar *path); +#endif @@ -365,6 +368,9 @@ gimp_plug_in_open (GimpPlugIn *plug_in, /* Fork another process. We'll remember the process id so that we * can later use it to kill the filter if necessary. */ +#if defined G_OS_WIN32 && defined WIN32_32BIT_DLL_FOLDER + gimp_plug_in_set_dll_directory (argv[0]); +#endif if (! gimp_spawn_async (argv, envp, spawn_flags, &plug_in->pid, &error)) { gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR, @@ -403,6 +409,10 @@ gimp_plug_in_open (GimpPlugIn *plug_in, cleanup: +#if defined G_OS_WIN32 && defined WIN32_32BIT_DLL_FOLDER + gimp_plug_in_set_dll_directory (NULL); +#endif + if (debug) g_free (argv); @@ -726,6 +736,46 @@ gimp_plug_in_flush (GIOChannel *channel, return TRUE; } +#if defined G_OS_WIN32 && defined WIN32_32BIT_DLL_FOLDER +static void +gimp_plug_in_set_dll_directory (const gchar *path) +{ + const gchar *install_dir; + gchar *bin_dir; + LPWSTR w_bin_dir; + DWORD BinaryType; + int n; + + w_bin_dir = NULL; + install_dir = gimp_installation_directory (); + if (path && + GetBinaryTypeA (path, &BinaryType) && + BinaryType == SCS_32BIT_BINARY) + bin_dir = g_build_filename (install_dir, WIN32_32BIT_DLL_FOLDER, NULL); + else + bin_dir = g_build_filename (install_dir, "bin", NULL); + + n = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS, + bin_dir, -1, NULL, 0); + if (n == 0) + goto out; + + w_bin_dir = g_malloc_n (n + 1, sizeof (wchar_t)); + n = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS, + bin_dir, -1, + w_bin_dir, (n + 1) * sizeof (wchar_t)); + if (n == 0) + goto out; + + SetDllDirectoryW (w_bin_dir); + +out: + if (w_bin_dir) + g_free ((void*) w_bin_dir); + g_free (bin_dir); +} +#endif + GimpPlugInProcFrame * gimp_plug_in_get_proc_frame (GimpPlugIn *plug_in) { diff --git a/configure.ac b/configure.ac index ba5f069903..ed2e61b07e 100644 --- a/configure.ac +++ b/configure.ac @@ -904,6 +904,34 @@ if test "x$enable_win32_debug_console" = "xyes"; then fi AC_MSG_RESULT([$enable_win32_debug_console]) +###################################### +# Check for 32-bit DLLs (Win32 64-bit) +###################################### + +AC_ARG_WITH(win32-32bit-dll-folder, + [ --with-win32-32bit-dll-folder[=DIR] + alternative folder with 32-bit versions of DLL libraries on Windows (default: 32/bin/)],, + with_win32_32bit_dll_folder="32/bin") + +AC_MSG_CHECKING([the alternative folder containing 32-bit DLLs on Windows]) +if test "x$platform_win32" = "xyes"; then + case "$host_cpu" in + x86_64) + ;; + *) + with_win32_32bit_dll_folder="no" + ;; + esac +else + with_win32_32bit_dll_folder="no" +fi + +if test "x$with_win32_32bit_dll_folder" != "xno"; then + AC_DEFINE_UNQUOTED(WIN32_32BIT_DLL_FOLDER, "$with_win32_32bit_dll_folder", + [Define if 32-bit versions of libraries are packaged in an alternative folder]) +fi +AC_MSG_RESULT([$with_win32_32bit_dll_folder]) + ##################### # Check for Dr. Mingw ##################### @@ -2863,44 +2891,45 @@ generate_po_makefile([po-windows-installer]) # Print a summary of features enabled/disabled: optional_deps=" Extra Binaries: - gimp-console: $enable_gimp_console + gimp-console: $enable_gimp_console Optional Features: - Language selection: $have_iso_codes - Vector icons: $enable_vector_icons - Dr. Mingw (Win32): $enable_drmingw - Relocatable bundle: $enable_relocatable_bundle - Default ICC directory: $with_icc_directory - Debug console (Win32): $enable_win32_debug_console + Language selection: $have_iso_codes + Vector icons: $enable_vector_icons + Dr. Mingw (Win32): $enable_drmingw + Relocatable bundle: $enable_relocatable_bundle + Default ICC directory: $with_icc_directory + Debug console (Win32): $enable_win32_debug_console + 32-bit DLL folder (Win32): $with_win32_32bit_dll_folder Optional Plug-Ins: - Ascii Art: $have_libaa - Ghostscript: $have_gs - Help Browser: $have_webkit - JPEG 2000: $have_openjpeg - MNG: $have_libmng - OpenEXR: $have_openexr - WebP: $have_webp - Heif: $have_libheif - PDF (export): $have_cairo_pdf - Print: $enable_print - Python 2: $enable_python - TWAIN (Win32): $os_win32 - Webpage: $have_webkit - WMF: $have_libwmf - X11 Mouse Cursor: $have_xmc - XPM: $have_libxpm - Email: $have_email + Ascii Art: $have_libaa + Ghostscript: $have_gs + Help Browser: $have_webkit + JPEG 2000: $have_openjpeg + MNG: $have_libmng + OpenEXR: $have_openexr + WebP: $have_webp + Heif: $have_libheif + PDF (export): $have_cairo_pdf + Print: $enable_print + Python 2: $enable_python + TWAIN (Win32): $os_win32 + Webpage: $have_webkit + WMF: $have_libwmf + X11 Mouse Cursor: $have_xmc + XPM: $have_libxpm + Email: $have_email Optional Modules: - ALSA (MIDI Input): $have_alsa - Linux Input: $have_linux_input (GUdev support: $have_libgudev) - DirectInput (Win32): $have_dx_dinput + ALSA (MIDI Input): $have_alsa + Linux Input: $have_linux_input (GUdev support: $have_libgudev) + DirectInput (Win32): $have_dx_dinput Tests: - Use xvfb-run $have_xvfb_run - Test appdata $have_appstream_util - Test desktop file $have_desktop_file_validate + Use xvfb-run $have_xvfb_run + Test appdata $have_appstream_util + Test desktop file $have_desktop_file_validate Bug report URL: $with_bug_report_url $override_bug_report_url$have_recommended_gtk$warning_vector_icons_windows$warning_glib_networking$warning_gcc"