2

I'm having a very strange problem when trying to run RapidXml 1.13 under Windows CE 6.0 compiled with Visual Studio 2005. I have an extremely small program that fails to run:

#include <rapidxml.hpp>
using namespace rapidxml;

int _tmain(int argc, _TCHAR* argv[])
{
    xml_document<char> doc;
    return 0;
}

It compiles fine with 0 errors and 0 warnings (at W3). However, when I run or debug the program, I get an access violation exception:

First-chance exception at 0x000110d4 in RapidXml_Test.exe: 0xC0000005: Access violation writing location 0x0001fb48.

The debugger then points to this line (1366 in rapidxml.hpp) as the culprit (the open brace):

template<class Ch = char>
    class xml_document: public xml_node<Ch>, public memory_pool<Ch>
    {

    public:

        //! Constructs empty XML document
        xml_document()
            : xml_node<Ch>(node_document)
------->{
        }
...

If anyone has any clue what the problem could be I'd greatly appreciate it. I have much more complicated code working in my build and run-time environment so I don't suspect anything there. I'm also fairly confident it's not a project setting. I assume at this point that RapidXml's use of templates is somehow confusing the Windows CE VC++ compiler. I don't know what else it could be.

Thanks in advance!

Rotsiser Mho
  • 550
  • 2
  • 5
  • 19
  • 1
    does `xml_document<> doc;` also faile (the default is `char`)? How about `xml_document doc;`? CE is heavily biased toward unicode, so I'm wondering if something in the templates is getting expanded somewhere. – ctacke Sep 06 '11 at 01:52
  • It does. I figured it out. Updated question. Thanks! – Rotsiser Mho Sep 30 '11 at 03:57

1 Answers1

3

I found the solution. RapidXML allocates its own pool of memory once its loaded. Problem is, I think it allocates it on the stack and I was getting a stack overflow! (How serendipitous that the problem with my first question here actually WAS a stack overflow). Anyways, reducing the size of the pool solved my problem.

Rotsiser Mho
  • 550
  • 2
  • 5
  • 19