this is the first time I’ve tried to export a class from a dll.
what I’ve done is:
– crated an interface (only pure virtual methods)
– implemented this interface in the dll with a class that wont be exported
– the class has a release method that calls delete on its this pointer
– created a Factory class with a static method that returns a pointer to the concrete class but as the interface. this class is exported.
– the deletion of the returned object is done by calling its release method.
I tuck all this from this tutorial about classes in dlls.
The problem is that when I use this dll in another project everything goes ok until I call the release function on the object.
Then it shows an assertion failed window with the message “_ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));”
Did this happened to anybody else?
I know this is as simple as forgetting to use std:: when you start C++ , but as I said I just started this.
Thanks!
Thanks for your answers, and I’m sorry I started this for nothing!
The problem was very simple but hidden behind the interfaces , factory , and some other stuff.
I was returning a pointer to an object that was declared as static because it has to be a singleton. Then I was trying to release this object. BANG heap corruption!!
My singleton object shouldn’t have a release function in the first place;
I’ll solve this by extracting the release function in a separate interface , that will be implemented only by non static objects.