Following is the situation:
I have a dynamic library which has a static method and creates and returns a pointer to the class object.
I load this library from an executable, call the static method and try deleting the pointer. It complains with the following:
Debug assertion failed.
I need to know why is this happening?
Please guide to me any relevant article which might be useful for understanding this topic.
// Header file for my library : mylib.h
#define DllExport __declspec(dllexport)
#define DllExport __declspec(dllimport)
#endif // MYLIB_EXPORTS
DllExport static MyLib* New();
//Implementation of mylib.cpp//
DllExport MyLib* MyLib::New()
MyLib* mylib = new MyLib();
// Executable implementation
MyLib* mylib = MyLib::New();
delete mylib; // this delete gives problem