I'm using a DLL which performs some memory allocation and returns a pointer. The code is something like that:
ObjectClass *obj = FunctionFromDLL();
obj is a valid pointer but obj->SubObject is a bad pointer (0xcdcdcd)
I checked and FunctionFromDLL() correctly allocates SubObject, this pointer only gets a bad value when function is returning to caller.
Is there something special for the DLL to "share" its memory?
There is no special way of sharing memory allocated between dll and app, just make sure to delete memory in dll AFTER you don't use it anymore.
Edit: 0xCDCDCDCD : Used by Microsoft's C++ debugging runtime library to mark uninitialised heap memory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With