Earnie wrote:
> Roumen Petrov wrote:
>> Earnie wrote:
>>> Earnie wrote:
>>>> Roumen Petrov wrote:
>>>>> Earnie wrote:
>>>>>> Earnie wrote:
>>>>>>> I've been building libxml2-2.7.8 and have been having a heck of
>>>>>>> a time getting xmlcatalog to work with a shared DLL library.
>>>>>>> I've finally confirmed that the issue is caused by optimizations
>>>>>>> with -O2 or -O1. If I use -O0 the issue goes away. The effect is
>>>>>>> the xmlIsPubidChar_tab array is seen by xmlcatalog to contain all
>>>>>>> 0x00 values. I'm using GCC-4.6.1 and binutils-2.21.53.20110804
>>>>>>> as delivered by MinGW. I wanted give this list a report of what
>>>>>>> I've found in the event others come by, they may have already.
>>>>> hmm ,
>>>>>
>>>>> Look like regression as it is fine with me for gcc/binutils: -
>>>>> 3.4.5/2.17.50 20070129 - 4.4.0/2.19.1
>>>>>
>>>> It was Kai Tietz who is active in GCC development for Windows and one of
>>>> its maintainers who pointed me to the issue resolution.
>>>>
>>>> See http://thread.gmane.org/gmane.comp.gnu.mingw.user/38000 for the
>>>> discussion.
>> [SNIP]
>> Above like is fine to follow the thread .
>> I'm not against the patch
>> a) it will resolve linking issue if libxml2 is build with gcc (mingw)
>> and -nocommon flag.
>> b) it will resolve issue with new gnu compiler/linker
>> c) libxslt and xmlsec for instance use extern for mingw* compilers
>>
>> Lets first finish discussion on mingw list as libxml and libxslt does
>> not use extern for cygwin compiler. If cygwin build is impacted then
>> complete patch must cover both woe compilers. Also  another patch for
>> libxslt is required .
>>
> 
> As discussed on the MinGW list here are the patches for both libxml2 and
> libxslt adorning dllexport with extern for both __CYGWIN__ and __MINGW32__.
> 
> During the discussion on the MinGW list we discovered the following bit
> of information about dllexport:
> 
> From:
> http://msdn.microsoft.com/en-us/library/y4h7bcy6.aspx
> 
> The use of dllexport implies a definition, while dllimport implies a
> declaration. You must use the extern keyword with dllexport to force a
> declaration; otherwise, a definition is implied.
> 
And now with attachments.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd/
????-??-?? Earnie Boyd <ear...@users.sourceforge.net>
        * include/libxml/xmlexports.h (XMLPUBFUN): Decorate with extern for both
        __MINGW32 and __CYGWIN__ as required by the MSDN documentation for
        dllexport.
        (XMLPUBVAR): Ditto.
diff --git a/include/libxml/xmlexports.h b/include/libxml/xmlexports.h
index 9c6790c..cdcda5a 100644
--- a/include/libxml/xmlexports.h
+++ b/include/libxml/xmlexports.h
@@ -114,8 +114,8 @@
    * by also making that declaration when compiling client code.
    */
   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
-    #define XMLPUBFUN __declspec(dllexport)
-    #define XMLPUBVAR __declspec(dllexport)
+    #define XMLPUBFUN __declspec(dllexport) extern
+    #define XMLPUBVAR __declspec(dllexport) extern
   #else
     #define XMLPUBFUN
     #if !defined(LIBXML_STATIC)
@@ -138,8 +138,8 @@
   #undef XMLCALL
   #undef XMLCDECL
   #if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
-    #define XMLPUBFUN __declspec(dllexport)
-    #define XMLPUBVAR __declspec(dllexport)
+    #define XMLPUBFUN __declspec(dllexport) extern
+    #define XMLPUBVAR __declspec(dllexport) extern
   #else
     #define XMLPUBFUN
     #if !defined(LIBXML_STATIC)
????-??-?? Earnie Boyd <ear...@users.sourceforge.net>
        * libexslt/exsltexports.h (EXSLTPUBFUN): Decorate with extern for both
        __MINGW32__ and __CYGWIN__ as required by the MSDN documentation for
        dllexport.
        (EXSLTPUBVAR): Ditto.
        * libxslt/xsltexports.h (XSLTPUBFUN): Ditto.
        (XSLTPUBVAR): Ditto.
        * tests/plugins/testplugin.c (xmlsoft_org_xslt_testplugin_init):
        Decorate the declaration with extern as required by the MSDN
        documentation for dllexport.
diff --git a/libexslt/exsltexports.h b/libexslt/exsltexports.h
index bead915..6cf3f8b 100644
--- a/libexslt/exsltexports.h
+++ b/libexslt/exsltexports.h
@@ -91,11 +91,8 @@
   #undef EXSLTPUBFUN
   #undef EXSLTPUBVAR
   #undef EXSLTCALL
-/*
   #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC)
-*/
-  #if !defined(LIBEXSLT_STATIC)
-    #define EXSLTPUBFUN __declspec(dllexport)
+    #define EXSLTPUBFUN __declspec(dllexport) extern
     #define EXSLTPUBVAR __declspec(dllexport) extern
   #else
     #define EXSLTPUBFUN
@@ -117,8 +114,8 @@
   #undef EXSLTPUBVAR
   #undef EXSLTCALL
   #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC)
-    #define EXSLTPUBFUN __declspec(dllexport)
-    #define EXSLTPUBVAR __declspec(dllexport)
+    #define EXSLTPUBFUN __declspec(dllexport) extern
+    #define EXSLTPUBVAR __declspec(dllexport) extern
   #else
     #define EXSLTPUBFUN
     #if !defined(LIBEXSLT_STATIC)
diff --git a/libxslt/xsltexports.h b/libxslt/xsltexports.h
index 825c122..bfefb60 100644
--- a/libxslt/xsltexports.h
+++ b/libxslt/xsltexports.h
@@ -93,11 +93,8 @@
   #undef XSLTPUBFUN
   #undef XSLTPUBVAR
   #undef XSLTCALL
-/*
   #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC)
-*/
-  #if !defined(LIBXSLT_STATIC)
-    #define XSLTPUBFUN __declspec(dllexport)
+    #define XSLTPUBFUN __declspec(dllexport) extern
     #define XSLTPUBVAR __declspec(dllexport) extern
   #else
     #define XSLTPUBFUN
@@ -119,8 +116,8 @@
   #undef XSLTPUBVAR
   #undef XSLTCALL
   #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC)
-    #define XSLTPUBFUN __declspec(dllexport)
-    #define XSLTPUBVAR __declspec(dllexport)
+    #define XSLTPUBFUN __declspec(dllexport) extern
+    #define XSLTPUBVAR __declspec(dllexport) extern
   #else
     #define XSLTPUBFUN
     #if !defined(LIBXSLT_STATIC)
diff --git a/tests/plugins/testplugin.c b/tests/plugins/testplugin.c
index 95bb450..966cfe6 100644
--- a/tests/plugins/testplugin.c
+++ b/tests/plugins/testplugin.c
@@ -41,7 +41,7 @@
 
 /* include a prototype to make gcc happy */
 void
-PLUGINPUBFUN xmlsoft_org_xslt_testplugin_init(void);
+PLUGINPUBFUN extern xmlsoft_org_xslt_testplugin_init(void);
 
 /************************************************************************
  *                                                                     *
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to