Returning objects allocated within DBX

Returning objects allocated within DBX

Anonymous
Not applicable
217 Views
1 Reply
Message 1 of 2

Returning objects allocated within DBX

Anonymous
Not applicable
I have a custom entity defined in a DBX. One of its methods has an argument
of std::string&, which is filled in within the function. I can call it from
my ARX, and the variable has the proper value. However, when the variable
goes out of scope, I get an exception in the destructor. I'm pretty sure
this is due to a different operator new being used within my custom entity
class. I know I could figure a way around this simple example, but in
general I may want to have a method on my custom entity that returns some
complex STL structure. Is there a straightforward way to force these objects
to be allocated using the "normal" new, so I don't run into problems when
they are destryed in the ARX?
0 Likes
218 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Turned out to be a problem of debug vs. non-debug new. For some reason in my
debug build, the DBX was using debug new, but the ARX was using non-debug
new, so when the ARX tried to delete the memory allocated in the DBX, it
threw an exception.

I don't know if anyone has general guielines for using STL with ObjectARX,
but I finally got it to work by including the STL headers (,
, etc) in StdAfx.h of both my DBX and ARX project, in the region
where the Windows headers are included and "_DEBUG" has been temporarily
undefined.

"Robert A. Strickland" wrote in message
news:6DBCB5C36E55CFF89BF53683A172F002@in.WebX.maYIadrTaRb...
> I have a custom entity defined in a DBX. One of its methods has an
argument
> of std::string&, which is filled in within the function. I can call it
from
> my ARX, and the variable has the proper value. However, when the variable
> goes out of scope, I get an exception in the destructor. I'm pretty sure
> this is due to a different operator new being used within my custom entity
> class. I know I could figure a way around this simple example, but in
> general I may want to have a method on my custom entity that returns some
> complex STL structure. Is there a straightforward way to force these
objects
> to be allocated using the "normal" new, so I don't run into problems when
> they are destryed in the ARX?
>
>
0 Likes