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 Holger Flörke <fl...@doctronic.de> on 2004/01/07 18:10:21 UTC

Xerces-C, XMemory, MSVC 6.0, and STL

Hi folks,

If I try to compile the follwoing code sample with MSVCP6.0

#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/dom/deprecated/DOMString.hpp>

#include <list>

int main(int argC, char* argV[])
{
   xercesc::XMLPlatformUtils::Initialize();
   {
     xercesc::DOMString o("smolerebroed");
     std::list<xercesc::DOMString> oList;
     oList.push_back(o);
   };

   xercesc::XMLPlatformUtils::Terminate();
   return 0;
};


I get the following error (sorry, only in german):

C:\Programme\Microsoft Visual Studio\VC98\INCLUDE\xmemory(34) : error 
C2665: 'new' : Durch keine der 2 Ueberladungen kann Parameter 2 vom Typ 
'void *' konvertiert werden
         C:\Programme\Microsoft Visual Studio\VC98\INCLUDE\xmemory(66) : 
Siehe Verweis auf Instantiierung der kompilierten Funktionsvorlage 'void 
__cdecl std::_Construct(class xercesc_2_3::DOMString *,const class 
xercesc_2_3::DOMString &)'


This is because my <xmemory>-include states:

template<class _T1, class _T2> inline
void _Construct(_T1 _FARQ *_P, const _T2& _V)
{new ((void _FARQ *)_P) _T1(_V); }

Please note the second void* argument _P of the new operator.

The default operator new in <new> implements this as

inline void *__cdecl operator new(size_t, void *_P)
	{return (_P); }

The XMemeory interface of DOMString does not have such a new operator (used 
by the push_back).

If I define and implement them in xercesc XMemory interface
...
     void* operator new(size_t size, void* driss) { return driss; }
     void operator delete(void* p, void* driss) { };
...

Everything works fine. Does anybody have this problem, too? Am I the only 
fool using the deprecated Xerces-C DOMString and MSVC-STL together?

HolgeR
-- 
holger floerke                      d  o  c  t  r  o  n  i  c
email floerke@doctronic.de          information publishing + retrieval
phone +49 2222 9292 90              http://www.doctronic.de



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