November 12th, 2009, 11:25 AM
problem with freeing memory in dll
i have a dll that exports a class - it uses an abstract base class with pure virtual functions(defined in a header file), then a function to export it that returns a new object. insided the class is a 'release' function that deletes the object. now in another dll of mine, i dont do anything with the deconstructor, but in this one for some reason i have to have the same 'delete this' as i do in the release function or it crashes. now in the host application is where i get some sort of problem. note - it runs/finishes without error but some code isnt being exectued or something.
typedef IMyObj* (*PFNCreate)();
char dllName = "dllname.dll";
HMODULE hmod = LoadLibrary(dllName);
cout << "error loading dll" << endl;
PFNCreate pfnCreate = (PFNCreate)GetProcAddress(hmod, \
IMyObject* obj = (pfnCreate)();
cout << "??" << endl; //i get this outputted
cout << "??"; //######## THIS DOESNT GET PRINTED
thank you in advance, if more code is necessary to see what is going on let me know and ill post it.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!