Original Post
Hey.
I''m having some trouble with function pointers.
I''m trying to get the function pointer to a function in a .dll file, and then call it from the program (the .exe file).
When I compile, the line where I call the function fails. I have commented that line below.
bool CEngine::LoadMod(const char *szModName)
{
int (*p_fnEntry)(int (*syscall)(int, ...)) = NULL;
if (!m_Mod.LoadModule(szModName))
{
return false;
}
p_fnEntry = (int (*)(int (*)(int, ...))) GetProcAddress(m_Mod.m_hMod,"vmEntry");
p_fnEntry(SysCall); //this one won''t compile
return true;
}
The function pointer p_fnEntry should accept another function pointer, but it doesn''t. I just get the following compile error:
error C2664: ''int (int (__cdecl *)(int,...))'' : cannot convert parameter 1 from ''overloaded-function'' to ''int (__cdecl *)(int,...)''
The SysCall function that is passed to p_fnEntry is a member function of CEngine:
int CEngine::SysCall(int operation, ...);
Can someone tell me what could be wrong?
I have checked that the function data type and the argument''s data types are correct.
Could the problem have something to do with that I''m using an variable argument list on the SysCall function?
I hope anyone can help.
"The mistakes are all waiting to be made.
--{You fight like a dairy farmer!}