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 Alexander Konovalov <ak...@esri.com> on 2000/07/12 05:51:50 UTC

DOMString::transcode()

Quick question:

Sometimes when I try to free pointer returned by DOMString::transcode()
I get an exception thrown from deep inside of "delete" operator:

      DOMString dstr = elem.getAttribute("name");
	char* ptr = dstr.transcode();
	printf("%s", ptr);
	delete[] ptr;               //<<< boooom!

I suspect that this happens because the memory is allocated in one DLL and
is actually freed from another one. 

Do you by any chance have a function in XML4C dll which could be used to 
free allocated by the DLL resources? Something like that

void XML4C_free( char* ptr )
{
   if ( ptr )
     {
     delete[] ptr;
     ptr = NULL;
     }
}

Thanks,
Alexander Konovalov
akonovalov@esri.com

Re: DOMString::transcode()

Posted by Thomas Norton <to...@ndtechnologies.com>.
Dean,

Is there a problem compiling and using xerces-c_1_2.dll which was built
using the
"Release Multi-threaded" compiler option instead of the "Release
Multi-threaded DLL"
option?

I used "Release Multi-threaded" and "Debug Multi-threaded" to build versions
of
xerces-c_1_2.dll to link with .exe and COM dll applications.  This way I was
able to
delete anything allocated from DOMString::transcode(); from within the apps.

I do not understand the implications of using the non-dll version of the
multithreaded lib.
Any insight would be greatly appreciated.

Thanks,
   - Tom



----- Original Message -----
From: "Dean Roddey" <dr...@charmedquark.com>
To: <xe...@xml.apache.org>
Sent: Wednesday, July 12, 2000 1:08 AM
Subject: Re: DOMString::transcode()


> YOu have to build your own project with the same runtime as the parser.
The
> production DLLs are "Multi-threaded DLL". If you use anything else, you
are
> asking for trouble. If you want to do a debug build of your stuff, you
still
> have to use the non-debug runtime, unless you rebuild our stuff for debug
> mode.
>
> --------------------------
> Dean Roddey
> The CIDLib C++ Frameworks
> Charmed Quark Software
> droddey@charmedquark.com
> http://www.charmedquark.com
>
> "You young, and you gotcha health. Whatchoo wanna job fer?"
>
>
> ----- Original Message -----
> From: "Alexander Konovalov" <ak...@esri.com>
> To: "Xerec Mailing list (E-mail)" <xe...@xml.apache.org>
> Sent: Tuesday, July 11, 2000 8:51 PM
> Subject: DOMString::transcode()
>
>
> > Quick question:
> >
> > Sometimes when I try to free pointer returned by DOMString::transcode()
> > I get an exception thrown from deep inside of "delete" operator:
> >
> >       DOMString dstr = elem.getAttribute("name");
> > char* ptr = dstr.transcode();
> > printf("%s", ptr);
> > delete[] ptr;               file://<<< boooom!
> >
> > I suspect that this happens because the memory is allocated in one DLL
and
> > is actually freed from another one.
> >
> > Do you by any chance have a function in XML4C dll which could be used to
> > free allocated by the DLL resources? Something like that
> >
> > void XML4C_free( char* ptr )
> > {
> >    if ( ptr )
> >      {
> >      delete[] ptr;
> >      ptr = NULL;
> >      }
> > }
> >
> > Thanks,
> > Alexander Konovalov
> > akonovalov@esri.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>


Re: DOMString::transcode()

Posted by Dean Roddey <dr...@charmedquark.com>.
YOu have to build your own project with the same runtime as the parser. The
production DLLs are "Multi-threaded DLL". If you use anything else, you are
asking for trouble. If you want to do a debug build of your stuff, you still
have to use the non-debug runtime, unless you rebuild our stuff for debug
mode.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


----- Original Message -----
From: "Alexander Konovalov" <ak...@esri.com>
To: "Xerec Mailing list (E-mail)" <xe...@xml.apache.org>
Sent: Tuesday, July 11, 2000 8:51 PM
Subject: DOMString::transcode()


> Quick question:
>
> Sometimes when I try to free pointer returned by DOMString::transcode()
> I get an exception thrown from deep inside of "delete" operator:
>
>       DOMString dstr = elem.getAttribute("name");
> char* ptr = dstr.transcode();
> printf("%s", ptr);
> delete[] ptr;               file://<<< boooom!
>
> I suspect that this happens because the memory is allocated in one DLL and
> is actually freed from another one.
>
> Do you by any chance have a function in XML4C dll which could be used to
> free allocated by the DLL resources? Something like that
>
> void XML4C_free( char* ptr )
> {
>    if ( ptr )
>      {
>      delete[] ptr;
>      ptr = NULL;
>      }
> }
>
> Thanks,
> Alexander Konovalov
> akonovalov@esri.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>