Tobias,
In C++, the new operator returns a pointer to the newly created object. So
at first glance, your code should be modified to read:
DOMString* pMyStr = new DOMString("foo");
Later in your code, before pMyStr goes out of scope, you should call
delete pMyStr;
to release the memory explicitly or you will get a leak. (The use of p in
the name is a common convention, though not of course required, that reminds
you that you are working with a pointer to an object rather than the object
itself.)
Alternatively, if you do not need to allocate the object on the heap, you
can create a temporary quite simply:
DOMString myStr("foo");
The string will get cleaned up automatically when myStr goes out of scope.
Doug Brower
> I have a question about the DOMString class. I am writing a
> JNI-based library to access Xerces-J DOMs from C++. In looking for a
> decent string class to pass data around my wrapper classes, I came
> across Xerces-C's DOMString class.
>
> I tried linking to the xerces-c stub library and implementing
> DOMString in my code, but a simple call such as:
>
> DOMString myStr = new DOMString("foo");
>
> causes my library to terminate unexpectedly. Are there any special
> precautions I need to take when using the DOMString class?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]