[omniORB] String_var problems in Visual Studio .NET 2003
David Bellette
david.bellette at nec.com.au
Mon Nov 17 14:31:37 GMT 2003
Hi
I've been using omniORB for quite some time now.
I've compiled omniORB 4.0.2 successfully with VS .NET 2003 (using
platform = x86_nt_4.0_vs_7) and have managed to get my old VS 6 C++
application running correctly.
One of the patches I need to do was change the following line of code as
it was throwing heap errors on destruction:
CORBA::Object* pObject = <some corba object>
if (0)
{
// This causes a crash with VS 7 but Ok with VS6...
CORBA::String_var lStrObject = orb->object_to_string(pObject);
}
else
{
char* s = orb->object_to_string(pObject);
CORBA::string_free(s);
}
I can't for the life of me see why the lower code works, while the upper
code the heap error on destruction of CORBA::String_var. It has been
working fine for VS6 for quite some time.
My understanding is the object_to_string() returns a pointer which must
be freed (hence the lower solution working), but isn't the upper
solution consuming the string and freeing the memory on destruction?
I can live with the lower solution, but I'd like to satisfy my
curiousity, if anyone can help me out.
Thanks
David
More information about the omniORB-list
mailing list