//Code for loading in the DLL
//Function pointer for the DLL function
typedef Output (WINAPI *AIFunc)(Input, float);
//Struct that I store the dll info into
struct AiInfo
{
AIFunc function;
HINSTANCE hInstLibrary;
};
AiInfo SomeMethod(char * filename)
{
AIFunc _AIFunc;
AiInfo info;
info.hInstLibrary = LoadLibrary(filename);
DWORD error = GetLastError();
if (info.hInstLibrary)
{
_AIFunc = (AIFunc)GetProcAddress(info.hInstLibrary, aiFunc);
if (_AIFunc)
{
info.function = _AIFunc;
return;
}
}
else
{
std::cout << "DLL Failed To Load!" << std::endl;
}
return info;
}