[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 5 20:03:56 UTC 2018


 include/vcl/builderfactory.hxx |   19 ++++++-------------
 vcl/source/window/builder.cxx  |   28 ++++++++++++++++++++++++----
 2 files changed, 30 insertions(+), 17 deletions(-)

New commits:
commit 9ddb1a12332cd1ac528b1e25d2414dbfe2088811
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Nov 5 21:49:59 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Nov 5 22:01:31 2018 +0200

    Check explicitly for function names and link directly to them on iOS
    
    When building the iOS app with optimisation (using the Release
    configurtaion), the linker will not include functions even if they
    have been marked with __attribute__ ((visibility("default"))). To get
    such a function included, you need an actual reference to it.
    
    Sure, I could probably do some other trick instead. Or I could use a
    table and loop here instead of a sequence of if statements. Later.
    
    Change-Id: I86fa38838f242fd1ac251da6e3885f5b166963d3

diff --git a/include/vcl/builderfactory.hxx b/include/vcl/builderfactory.hxx
index 4b8801341f49..0781726c0ffb 100644
--- a/include/vcl/builderfactory.hxx
+++ b/include/vcl/builderfactory.hxx
@@ -37,6 +37,9 @@
         rRet = VclPtr<typeName>::Create(pParent,wb); \
     }
 
+#define VCL_BUILDER_FACTORY_EXTERN(typeName) \
+    extern "C" void make##typeName(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap)
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 6be921bff169..b4c38ca77d30 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -20,6 +20,7 @@
 #include <sal/log.hxx>
 #include <unotools/resmgr.hxx>
 #include <vcl/builder.hxx>
+#include <vcl/builderfactory.hxx>
 #include <vcl/button.hxx>
 #include <vcl/dialog.hxx>
 #include <vcl/edit.hxx>
@@ -1488,6 +1489,15 @@ void VclBuilder::preload()
 #endif // DISABLE_DYNLOADING
 }
 
+#if defined DISABLE_DYNLOADING && !HAVE_FEATURE_DESKTOP
+
+VCL_BUILDER_FACTORY_EXTERN(CustomPropertiesControl);
+VCL_BUILDER_FACTORY_EXTERN(RefButton);
+VCL_BUILDER_FACTORY_EXTERN(RefEdit);
+VCL_BUILDER_FACTORY_EXTERN(ScRefButtonEx);
+
+#endif
+
 VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &name, const OString &id,
     stringmap &rMap)
 {
@@ -2040,12 +2050,22 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
             }
             else
                 pFunction = reinterpret_cast<customMakeWidget>(aI->second->getFunctionSymbol(sFunction));
+#elif !HAVE_FEATURE_DESKTOP
+            if (false)
+                ; // Just so that all the other condition line pairs look the same
+            else if (sFunction == "makeCustomPropertiesControl")
+                pFunction = makeCustomPropertiesControl;
+            else if (sFunction == "makeRefButton")
+                pFunction = makeRefButton;
+            else if (sFunction == "makeRefEdit")
+                pFunction = makeRefEdit;
+            else if (sFunction == "makeScRefButtonEx")
+                pFunction = makeScRefButtonEx;
+
+            SAL_WARN_IF(!pFunction, "vcl.layout", "Missing case for " << sFunction);
+            assert(pFunction);
 #else
             pFunction = reinterpret_cast<customMakeWidget>(osl_getFunctionSymbol((oslModule) RTLD_DEFAULT, sFunction.pData));
-#if !HAVE_FEATURE_DESKTOP
-            SAL_WARN_IF(!pFunction, "vcl.layout", "Lookup of " << sFunction << " failed");
-            assert(pFunction);
-#endif
 #endif
             if (pFunction)
             {
commit 0cb0c7f02b745bc040c19aa26c6139dfc1833210
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Nov 5 20:45:34 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Nov 5 21:54:20 2018 +0200

    Revert "For iOS, do actually export UI builder factory functions"
    
    This doesn't work in a Release build. The functions in question don't
    get included in the binary. Will have to use a different approach,
    with actual references to the needed functions.
    
    This reverts commit 617479a003b5f3fa876e371fe16d3a5678f2c501.

diff --git a/include/vcl/builderfactory.hxx b/include/vcl/builderfactory.hxx
index 1b2d01bd918c..4b8801341f49 100644
--- a/include/vcl/builderfactory.hxx
+++ b/include/vcl/builderfactory.hxx
@@ -13,32 +13,22 @@
 #include <vcl/vclptr.hxx>
 #include <vcl/builder.hxx>
 
-// For iOS, SAL_DLLPUBLIC_EXPORT actually expands to __attribute__
-// ((visibility("hidden"))). (Ditto for other DISABLE_DYNLOADING
-// cases, but let it be as is for them for now.) Undo that trick.
-
-#ifdef IOS
-#define BUILDER_FACTORY_EXPORT __attribute__ ((visibility("default")))
-#else
-#define BUILDER_FACTORY_EXPORT SAL_DLLPUBLIC_EXPORT
-#endif
-
 #define VCL_BUILDER_FACTORY(typeName) \
-    extern "C" BUILDER_FACTORY_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
+    extern "C" SAL_DLLPUBLIC_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
     { \
         (void)rMap; \
         rRet = VclPtr<typeName>::Create(pParent); \
     }
 
 #define VCL_BUILDER_FACTORY_ARGS(typeName,arg1) \
-    extern "C" BUILDER_FACTORY_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
+    extern "C" SAL_DLLPUBLIC_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
     { \
         (void)rMap; \
         rRet = VclPtr<typeName>::Create(pParent,arg1); \
     }
 
 #define VCL_BUILDER_FACTORY_CONSTRUCTOR(typeName,arg2) \
-    extern "C" BUILDER_FACTORY_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
+    extern "C" SAL_DLLPUBLIC_EXPORT void make##typeName(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) \
     { \
         OUString sBorder = BuilderUtils::extractCustomProperty(rMap); \
         WinBits wb = arg2; \


More information about the Libreoffice-commits mailing list