You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Steven J. Hathaway" <sh...@e-z.net> on 2009/05/26 06:40:02 UTC

C Language Issue with XercesDefs.hpp - v 3.0.1

A patch is required in order for XALAN-C 1.11 to use its C-APIs with
XERCES-C 3.0.1 using Microsoft C Compilers (not C++).

File: src/xercesc/util/XercesDefs.hpp

Old Section
// 
---------------------------------------------------------------------------
// Define namespace symbols if the compiler supports it.
// 
---------------------------------------------------------------------------
#if defined(XERCES_HAS_CPP_NAMESPACE)
    #define XERCES_CPP_NAMESPACE_BEGIN namespace XERCES_CPP_NAMESPACE {
    #define XERCES_CPP_NAMESPACE_END  }
    #define XERCES_CPP_NAMESPACE_USE using namespace XERCES_CPP_NAMESPACE;
    #define XERCES_CPP_NAMESPACE_QUALIFIER XERCES_CPP_NAMESPACE::

    namespace XERCES_CPP_NAMESPACE { }
    namespace xercesc = XERCES_CPP_NAMESPACE;
#else
    #define XERCES_CPP_NAMESPACE_BEGIN
    #define XERCES_CPP_NAMESPACE_END
    #define XERCES_CPP_NAMESPACE_USE
    #define XERCES_CPP_NAMESPACE_QUALIFIER
#endif

===========================================================================
Edit Section:  Add test for (__cplusplus)
This prevents 'C' compilers from trying to invoke the 'namespace' commands.
I found this issue when trying to build XALAN-C XSLT ransformation using the
XALAN C-APIs with Microsoft C (not C++) compilation.  Adding the test
for defined(__cplusplus) resolves the C language compatibility issue.
===========================================================================
// 
---------------------------------------------------------------------------
// Define namespace symbols if the compiler supports it.
// 
---------------------------------------------------------------------------
#if defined(XERCES_HAS_CPP_NAMESPACE) && defined(__cplusplus)
    #define XERCES_CPP_NAMESPACE_BEGIN namespace XERCES_CPP_NAMESPACE {
    #define XERCES_CPP_NAMESPACE_END  }
    #define XERCES_CPP_NAMESPACE_USE using namespace XERCES_CPP_NAMESPACE;
    #define XERCES_CPP_NAMESPACE_QUALIFIER XERCES_CPP_NAMESPACE::

    namespace XERCES_CPP_NAMESPACE { }
    namespace xercesc = XERCES_CPP_NAMESPACE;
#else
    #define XERCES_CPP_NAMESPACE_BEGIN
    #define XERCES_CPP_NAMESPACE_END
    #define XERCES_CPP_NAMESPACE_USE
    #define XERCES_CPP_NAMESPACE_QUALIFIER
#endif



---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: C Language Issue with XercesDefs.hpp - v 3.0.1

Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi Steven,

Steven J. Hathaway <sh...@e-z.net> writes:

> A patch is required in order for XALAN-C 1.11 to use its C-APIs with
> XERCES-C 3.0.1 using Microsoft C Compilers (not C++).
> 
> Edit Section:  Add test for (__cplusplus)
> This prevents 'C' compilers from trying to invoke the 'namespace' commands.
> I found this issue when trying to build XALAN-C XSLT ransformation using the
> XALAN C-APIs with Microsoft C (not C++) compilation.  Adding the test
> for defined(__cplusplus) resolves the C language compatibility issue.

I don't think this is the right thing to do. XercesDefs.hpp is a C++
header and is not meant to be included from C source. I suggest that
you contact the XALAN-C developers about this.

Boris

-- 
Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org