ALL,
This is a continuation of this thread.
It looks like that the pointer that has been allocated inside DLL will become bad after the DLL is unloaded. Following suggestion by TBBle given in the mentioned thread it works if I immediately delete the pointer in the same function, but if I return the pointer back to the main application and then will try to access it from a different function, the pointer becomes bad.
I believe that even if I put the Foo class inside the main application it will not do me any good but I may be wrong. The reason for that is because the DLL2 will be unloaded with the unloading of DLL3.
So any idea how to make the compiler happy, don't introduce any memory leaks and don't crash?
Thank you.
P.S.: I am just follow the suggestion given at the end of the comments to create a new question. Apologies if this is bad thing to do.