[gedit/master-msvc: 5/10] gedit.c: Correct libgedit filename on MSVC




commit 36ca062e08ab29251c7c1ce12fdcc27ad193f57a
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Aug 23 18:53:31 2021 +0800

    gedit.c: Correct libgedit filename on MSVC
    
    ...or MSVC-style compilers, as Meson does not put a 'lib' prefix in
    library names by default.

 gedit/gedit.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/gedit/gedit.c b/gedit/gedit.c
index ee3769537..6d30d08dc 100644
--- a/gedit/gedit.c
+++ b/gedit/gedit.c
@@ -38,6 +38,13 @@
 
 #ifdef G_OS_WIN32
 #include <gmodule.h>
+
+#ifdef _MSC_VER
+#define GEDIT_DLL_PREFIX ""
+#else
+#define GEDIT_DLL_PREFIX "lib"
+#endif
+
 static GModule *libgedit_dll = NULL;
 
 /* This code must live in gedit.exe, not in libgedit.dll, since the whole
@@ -61,7 +68,7 @@ gedit_w32_load_private_dll (void)
                 * But since we only have one library, and its name is known, may as well
                 * use gmodule.
                 */
-               dllpath = g_build_filename (prefix, "lib", "gedit", "lib" PACKAGE_STRING ".dll", NULL);
+               dllpath = g_build_filename (prefix, "lib", "gedit", GEDIT_DLL_PREFIX PACKAGE_STRING ".dll", 
NULL);
                g_free (prefix);
 
                libgedit_dll = g_module_open (dllpath, 0);
@@ -76,10 +83,10 @@ gedit_w32_load_private_dll (void)
 
        if (libgedit_dll == NULL)
        {
-               libgedit_dll = g_module_open ("lib" PACKAGE_STRING ".dll", 0);
+               libgedit_dll = g_module_open (GEDIT_DLL_PREFIX PACKAGE_STRING ".dll", 0);
                if (libgedit_dll == NULL)
                {
-                       g_printerr ("Failed to load 'lib" PACKAGE_STRING ".dll': %s\n",
+                       g_printerr ("Failed to load '" GEDIT_DLL_PREFIX PACKAGE_STRING ".dll': %s\n",
                                    g_module_error ());
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]