GCCDefs str[n]icmp prototype and symbol exposure
------------------------------------------------

                 Key: XERCESC-1917
                 URL: https://issues.apache.org/jira/browse/XERCESC-1917
             Project: Xerces-C++
          Issue Type: Bug
          Components: Build
    Affects Versions: 2.8.0
         Environment: linux x86_64 gcc
            Reporter: George Gensure


The stricmp and strnicmp prototypes provided as a workaround for those 
functions missing in gcc/glibc installations are defined in the global scope 
and without extern "C" qualifiers.  As a result, these are the *only* 
non-xerces_2_8 namespaced functions exposed by the shared library on linux.  I 
recognize that the compiler workarounds are included prior to the xercesc 
namespace definition, and as a compromise I'd be happy to see the definitions 
have their prototypes changed to be within an extern "C" block, as well as 
__attribute__((visibility("hidden"))) applied to their definitions.  The 
following diff applies cleanly to the 2.8 release and corrects my problem:

--- src/xercesc/util/Compilers/GCCDefs.hpp
+++ src/xercesc/util/Compilers/GCCDefs.hpp
@@ -130,8 +130,10 @@

 #if !defined(__CYGWIN__) && !defined(__MINGW32__)

+extern "C" {
 int stricmp(const char* const str1, const char* const  str2);
 int strnicmp(const char* const str1, const char* const  str2, const unsigned 
int count);
+}

 #endif // ! __CYGWIN__

--- src/xercesc/util/Compilers/GCCDefs.cpp
+++ src/xercesc/util/Compilers/GCCDefs.cpp
@@ -33,11 +33,13 @@

 #if !defined(__CYGWIN__) && !defined(__MINGW32__)

+__attribute__((visibility("hidden")))
 int stricmp(const char* const str1, const char* const  str2)
 {
  return strcasecmp(str1, str2);
 }

+__attribute__((visibility("hidden")))
 int strnicmp(const char* const str1, const char* const  str2, const unsigned 
int count)
 {
  if (count == 0)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to