nachiket's picture

I got pion web service working. I made a small modification to the HelloService.cpp file, I changed

static const std::string HELLO_HTML = "Hello World!";

to

std::string HELLO_HTML = "Hello World!";

and I started getting "string iterator not dereferencable" error.

This is on windows.

Any ideas?

Mike Dickey's picture
The HelloService example uses

The HelloService example uses "writeNoCopy" which requires that the string will be accessible in memory until the server has completed the response (i.e. it is a static string, or you have some other way to guarantee this).

If you want to use a stack-allocated string instead, then you need to change this line:

writer->writeNoCopy(HELLO_HTML);

to this:

writer->write(HELLO_HTML);

Submitted by Mike Dickey on Tue, 05/26/2009 - 11:17.