I have a DLL in which I know the functions implemented and the classes names. However, I don't know much more. I would like to create an object from this class in the DLL and use the methods. How can I perform this? I successfully get function from this dll with the following example:
typedef int (__stdcall *f_dll)();
std::string filename = "C:\\Test.dll";
std::wstring tmp = s2ws(filename);
HINSTANCE hGetProcIDDLL = LoadLibrary(tmp.c_str());
if (!hGetProcIDDLL)
{
std::cerr << "Failed to load DLL" << std::endl;
return EXIT_FAILURE;
}
// resolve function address here
f_dll func = (f_dll)GetProcAddress(hGetProcIDDLL, "function");
if (!func)
{
std::cout << "Failed to load function inside DLL" << std::endl;
return EXIT_FAILURE;
}