I am loading the C++ DLL dynamically into the exe written in C++.
My requirement is
1) Loading the DLL dynamicaaly using LoadLibrary()
2) The calling the GetProcAddress more than few time to assign same function pointer as the functions get called in DLL has got the same signature.
3) So Do I have to release any resources in my code for lpfn function pointer before the second function (Function_2) gets called?
//Function pointer
typedef int (__stdcall *EntryPoint)(int nContext, BYTE *pySeed, int nSeedSize, BYTE *pyKey, int *pnKeySize);
int main()
{
HMODULE hDllHandle = LoadLibrary("SA.dll"); // load dll
if (hDllHandle)
{
EntryPoint lpfn= 0;
if (lpfn = (EntryPoint)GetProcAddress(hDllHandle, "Function_1"))
{
//call the function using lpfn
}
else
{
}
//should I release any resources on lpfn before I call/assign
// second function
if (lpfn = (EntryPoint)GetProcAddress(hDllHandle, "Function_2"))
{
//call the function using lpfn
}
else
{
}
}
}