Hi,,

    I appreciate the time you spend on this.

    Here is what I do to try and build with the new C++ standard library: 
    First, I've updated HPCCDefs.hpp as you suggested. Any reason why this 
wasn't done by the Xerces team?
    Then, I've created a script that exports the necessary variables:

===================start of script=====================
#!/bin/sh

export TRANSCODER="NATIVE"
export MESSAGELOADER="INMEM"
export NETACCESSOR="Socket"
export THREADS="pthread"
export BITSTOBUILD="32"
export CC="cc"
export CXX="aCC"
export CXXFLAGS=" -AA -w -O -DNDEBUG -DPROJ_XMLPARSER -DPROJ_XMLUTIL 
-DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM 
-DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER 
-DXML_USE_PTHREADS -DXML_USE_NETACCESSOR_SOCKET "
export CFLAGS=" -w -O -DNDEBUG -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS 
-DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM -DPROJ_VALIDATORS 
-DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS 
-DXML_USE_NETACCESSOR_SOCKET "
export LDFLAGS=" "
export LIBS=" -lpthread -lnsl -lstd_v2 -lCsup_v2"
./configure
===================end of script=====================

note the -AA in CXXFLAGS.

I build Xerces and the samples after creating the makefiles with the above 
script, but they do not work:

../bin/CreateDOMDocument
The tree just created contains: 

#ldd ../bin/CreateDOMDocument

        /usr/lib/libdld.2 =>    /usr/lib/libdld.2
        /usr/lib/libc.2 =>      /usr/lib/libc.2
        /usr/lib/libdld.2 =>    /usr/lib/libdld.2
        /usr/lib/libc.2 =>      /usr/lib/libc.2
        /usr/lib/libcl.2 =>     /usr/lib/libcl.2
        /usr/lib/libisamstub.1 =>       /usr/lib/libisamstub.1
        /usr/lib/libdld.2 =>    /usr/lib/libdld.2
        /usr/lib/libm.2 =>      /usr/lib/libm.2
        /usr/lib/libCsup.2 =>   /usr/lib/libCsup.2
        /usr/lib/libstream.2 => /usr/lib/libstream.2
        /usr/lib/libstd.2 =>    /usr/lib/libstd.2
        
/usr/dev/build/mmatei/sca-uc/dcaf_uc/xerces-c-current/xerces-c-src_2_7_0//lib/libxerces-c.sl.27
 =>      
/usr/dev/build/mmatei/sca-uc/dcaf_uc/xerces-c-current/xerces-c-src_2_7_0//lib/libxerces-c.sl.27
        /usr/lib/libCsup_v2.2 =>        /usr/lib/libCsup_v2.2
        /usr/lib/libstd_v2.2 => /usr/lib/libstd_v2.2
        /usr/lib/libnsl.1 =>    /usr/lib/libnsl.1
        /usr/lib/libxti.2 =>    /usr/lib/libxti.2
        /usr/lib/libpthread.1 =>        /usr/lib/libpthread.1
        /usr/lib/libpthread.1 =>        /usr/lib/libpthread.1

Anything obviously wrong here?

Thanks.

----- Original Message ----
From: David Bertoni <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, May 7, 2007 10:13:51 PM
Subject: Re: HP-UX, aCC and namespace std

Mihai Matei wrote:
> Hi, thanks for the reply.
> 
> If I don't specify the libraries at link time, I get unresolved symbols.

Then there's something wrong with the way you're compiling and linking.

> 
> And I tried modifying some parameters to get Xerces to build with the new 
> standard library, but the result was the same: broken sample binaries.

You need to determine what the default is for the compiler version and 
platform you're using and make sure everything is consistent.  The samples 
have a separate set of Makefiles, so you may need to make sure you've 
updated everything consistently.  I've built both -Aa and -AA binaries 
before, so it is possible.

> 
> Although I tried using a vector in a test program that does some xml 
> operations using Xerces, and turns out I don't have to compile with -AA to 
> get <vector> to work. When you say "the old standard library", are you 
> referring to the one that uses the old header files, iostream.h for example?

Yes.  That version of the library is not in the std namespace, and from 
your previous post, it seemed to me you wanted the version that _is_ in the 
std namespace.  But remember that there is some inconsistency with the 
header files.  If you include <vector>, you either get the version of 
vector that is not in the standard namespace, or the one that is, based on 
the -A flag.  On the other hand, you can still use iostream.h with the -AA 
switch.  That results in the inclusion of <iostream>, along with the using 
directive "using namespace std;"  That's probably not what you want.

You probably want to do something like this:

#include <vector>

#if defined(_HP_NAMESPACE_STD)
#include <iostream>
#else
#include <iostream.h>
#endif

int
main()
{
#if defined(_HP_NAMESPACE_STD)
     std::vector<int> foo;

     foo.push_back(3);
     std::cout << foo[0];
#else
     vector<int>  foo;

     foo.push_back(3);
     cout << foo[0];
#endif

     return 0;
}

To get this to work consistently with Xerces-C, you may need to update the 
HP compiler configuration file (src/xercesc/util/Compilers/HPCCDefs.hpp) 
and add some magic:

#if defined(_HP_NAMESPACE_STD)
#define XERCES_NEW_IOSTREAMS
#endif

Dave







 
____________________________________________________________________________________
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/

Reply via email to