I want to dynamically load the client dll in my C++ Windows application. So I am using ACE_DLL. I want to create the object of the class in client dll in my application . So I have written a wrapper class. One of its member function creates the object of ACE_DLL. Then using that object I am loading the client dll. Next I am calling the symbol function through ACE_DLL object and passing the mangled name of constructor of the class in client dll. Next I am calling the function pointer (_entry ) which contains address of the constructor but this time I am getting error as "Unhandled exception (Access violation)"
Please let me know if my approach is correct. Below are the calling sequence in my application.
ACE_DLL* _pDll;
typedef Test* (*TestFP)();
TestFP _entry;
_pDll = new ACE_DLL();
_pDll->open("dllname_to_be_opend");
std::string sSymbol = "Test";
// mangled name of the Test class constructor in client dll
_entry = (TestFP) _pDll->symbol(sSymbol.c_str());
Test *obj = _entry();
// Unhandled exception at 0x00362b2f in Testdll.exe: 0xC0000005: Access violation writing location 0x00362b0c.
Thank you, Prasad