Ralf Habacker schrieb:
Peter Kümmel schrieb:
Ralf Habacker wrote:
It's the only(?) simple alternative we have
to the inline solution.

But then we must move all the relevant
kjs_binding.cpp code into a extra file which
will build into the additional shared library.
Why ? If you define KDE_USTRING_EXPORT for the methods located in libkhtml when compiling to dllexport, than any functon in libkhtml which requires any of this function will look for a symbol in the recent library not for an external in the kjs library. This is what the test-kjs.patch does, or does I have misunderstand something important ?


Next time when I compile with mingw I'll give it a try.
And you are right, I also don't see a reason why it should not work.

But this solution introduces a additional shared library and
this is the reason I don't like very much.
No, the testcase simulates the usage of kjs, khtml and other client libraries/applications, which covers all available cases I know, which are:

1. compile kjs -> declare a method, but do not define it.
2. compiling khtml ->
   a. define methods declared by kjs
   b. use methods declared by kjs and defined in khtml
3. compile other libraries, which uses methods from kjs as well from khtml

The appended patch fixes this issue for whole kjs.
Update: Saw just an build issue with the previous patch, global.h.cmake was not updated. The appended includes this fix.

Ralf
The *.ii files in the testcase shows how the export definition of single UString members looks.

Isn't it simpler just to inline for all compilers?
It also gives us a little speed-up.
I don't know about the reasons, why they are defined in kjs_binding.cpp

As I understand it, the reasons for these functions are to help the kde
development but also avoids the binding to Qt when compiled at Apple.

About how many functions are we talking ?


See the attached file which contains all the inline code and which
I forgot to post with the last patch.
No problem, this patch isn't required anymore, only the appended kjs-external.patch. Linking khtml does not have any kjs related problems anmore, only png related symbol missing error. Seems that png isn't detect on my checkout.

If you see no problem, I will check this in.


Ralf

------------------------------------------------------------------------

_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem

Index: kjs/ustring.h
===================================================================
--- kjs/ustring.h       (Revision 515389)
+++ kjs/ustring.h       (Arbeitskopie)
@@ -278,15 +278,15 @@
      * Note: feel free to contact me if you want to see a dummy header for
      * your favorite FooString class here !
      */
-    UString(const QString&);
+    KJS_EXTERNAL_EXPORT UString(const QString&);
     /**
      * Convenience declaration only ! See UString(const QString&).
      */
-    UString(const DOM::DOMString&);
+    KJS_EXTERNAL_EXPORT UString(const DOM::DOMString&);
     /**
      * Convenience declaration only ! See UString(const QString&).
      */
-    UString(const DOM::AtomicString&);
+    KJS_EXTERNAL_EXPORT UString(const DOM::AtomicString&);
 
     /**
      * Concatenation constructor. Makes operator+ more efficient.
@@ -358,15 +358,15 @@
     /**
      * @see UString(const QString&).
      */
-    DOM::DOMString domString() const;
+    KJS_EXTERNAL_EXPORT DOM::DOMString domString() const;
     /**
      * @see UString(const QString&).
      */
-    QString qstring() const;
+    KJS_EXTERNAL_EXPORT QString qstring() const;
     /**
      * @see UString(const QString&).
      */
-    QConstString qconststring() const;
+    KJS_EXTERNAL_EXPORT QConstString qconststring() const;
 
     /**
      * Assignment operator.
Index: kjs/global.h.cmake
===================================================================
--- kjs/global.h.cmake  (Revision 515389)
+++ kjs/global.h.cmake  (Arbeitskopie)
@@ -54,6 +54,22 @@
 # endif
 #endif
 
+// some methods are declared inside kjs and defined outside (currently only in 
khtml)
+// KJS_EXTERNAL_EXPORT should be prefixed to each related method
+#ifndef KJS_EXTERNAL_EXPORT
+# if defined(MAKE_KJS_LIB) 
+#  define KJS_EXTERNAL_EXPORT
+# elif defined(_WIN32) || defined(_WIN64)
+#  if defined(MAKE_KHTML_LIB)
+#   define KJS_EXTERNAL_EXPORT __declspec(dllexport)
+#  else 
+#   define KJS_EXTERNAL_EXPORT __declspec(dllimport)
+#  endif
+# else 
+#   define KJS_EXTERNAL_EXPORT
+# endif
+#endif
+
 #ifndef NDEBUG // protection against problems if committing with KJS_VERBOSE on
 
 // Uncomment this to enable very verbose output from KJS
Index: kjs/identifier.h
===================================================================
--- kjs/identifier.h    (Revision 515389)
+++ kjs/identifier.h    (Arbeitskopie)
@@ -53,11 +53,11 @@
        * returns a UString of the identifier
        */
         const UString &ustring() const { return _ustring; }
-        DOM::DOMString domString() const;
+        KJS_EXTERNAL_EXPORT DOM::DOMString domString() const;
         /**
        * returns a QString of the identifier
        */
-       QString qstring() const;
+        KJS_EXTERNAL_EXPORT QString qstring() const;
 
        /**
        * returns a UChar pointer to the string of the identifier with a size 
defined by @ref size().
Index: kjs/global.h.in
===================================================================
--- kjs/global.h.in     (Revision 515389)
+++ kjs/global.h.in     (Arbeitskopie)
@@ -43,7 +43,7 @@
 #ifndef KJS_EXPORT
 # ifdef __KDE_HAVE_GCC_VISIBILITY
 #  define KJS_EXPORT __attribute__ ((visibility("default")))
-# elif defined(_MSC_VER)
+# elif defined(_WIN32) || defined(_WIN64)
 #  ifdef MAKE_KJS_LIB
 #   define KJS_EXPORT __declspec(dllexport)
 #  else
@@ -54,6 +54,22 @@
 # endif
 #endif
 
+// some methods are declared inside kjs and defined outside (currently only in 
khtml)
+// KJS_EXTERNAL_EXPORT should be prefixed to each related method
+#ifndef KJS_EXTERNAL_EXPORT
+# if defined(MAKE_KJS_LIB) 
+#  define KJS_EXTERNAL_EXPORT
+# elif defined(_WIN32) || defined(_WIN64)
+#  if defined(MAKE_KHTML_LIB)
+#   define KJS_EXTERNAL_EXPORT __declspec(dllexport)
+#  else 
+#   define KJS_EXTERNAL_EXPORT __declspec(dllimport)
+#  endif
+# else 
+#   define KJS_EXTERNAL_EXPORT
+# endif
+#endif
+
 #ifndef NDEBUG // protection against problems if committing with KJS_VERBOSE on
 
 // Uncomment this to enable very verbose output from KJS
_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem

Reply via email to