delete question
-
Hi all. 1. I have a native struct with a pointer member.
typedef struct someStruct SomeStruct; struct someStruct{ ... SomeStruct *tp_nextp; };
I'm hosting that struct in a managed class as a field. Do I need to use the delete keyword on the pointer when the managed object is disposed? 2. If I put a pointer to a member of that struct, does it need to be deleted? Thanks, Yaakov -
Hi all. 1. I have a native struct with a pointer member.
typedef struct someStruct SomeStruct; struct someStruct{ ... SomeStruct *tp_nextp; };
I'm hosting that struct in a managed class as a field. Do I need to use the delete keyword on the pointer when the managed object is disposed? 2. If I put a pointer to a member of that struct, does it need to be deleted? Thanks, YaakovWhat I had seen when I was using MC++ was that if I had a COM object that was used inside of a managed object, the memory and the COM object would be cleaned up but only after the application exited, not when the managed object went away. We had to call a function to delete the COM object when we wanted to when the managed object was disposed. Not sure if it would be the same for you, but you could always turn that unmanaged struct into a class and put some code into the destructor to see when it gets called. Steve Maier, MCSD MCAD