[gjs/master.msvc: 2/3] gjs/global.cpp: Fix linking on Visual Studio builds



commit cc30059a674c0065d62d29ee2c2470705c60fceb
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Feb 5 16:23:03 2020 +0800

    gjs/global.cpp: Fix linking on Visual Studio builds
    
    It seems that Visual Studio does not like using external variables from a
    static constexpr construct in terms of linking to a DLL, so fix this by
    using a global constant that pulls in the external (constant) variable that we
    are using, and use that global constant in our static constexpr construct,
    which will fix linking on Visual Studio.

 gjs/global.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gjs/global.cpp b/gjs/global.cpp
index 68002a77..2ebeeab2 100644
--- a/gjs/global.cpp
+++ b/gjs/global.cpp
@@ -225,11 +225,13 @@ gjs_printerr(JSContext *context,
     return true;
 }
 
+const JSClassOps defaultclassops = JS::DefaultGlobalClassOps;
+
 class GjsGlobal {
     static constexpr JSClass klass = {
         "GjsGlobal",
         JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(GJS_GLOBAL_SLOT_LAST),
-        &JS::DefaultGlobalClassOps,
+        &defaultclassops,
     };
 
     static constexpr JSFunctionSpec static_funcs[] = {


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