Yes, you need to cast. No you aren't missing anything.
Actually, I've just had a thought ... don't start adding the casts until I get back. I might just have a solution.
[EDIT]One helper class and a shed-load of replacement functions later ... Yep, got a solution, as long as your arguments and return types are up to 4 bytes in size - anything more and this won't work.
#include <DarkGDK.h>
#include "CallDLL.h"
void DarkGDK()
{
dbLoadDLL("user32.dll", 1);
int Result = dbCallDLL(1, "MessageBoxA", 0, "Message", "Caption", MB_OKCANCEL);
if (Result == IDOK)
{
dbPrint("You pressed OK");
}
else
{
dbPrint("You pressed CANCEL");
}
dbDeleteDLL(1);
dbSync();
dbSync();
dbWaitKey();
}
If you pass doubles as arguments, they will be down-cast to floats. long long's will be down-cast to int's, or DWORD's if they are unsigned.
The code will automatically convert the returned value to the type that you specify. If you don't get it right then that's your fault.
One final point: Despite the number of lines involved and the fact that there's a class converting all of the values to/from DWORD's, the optimiser actually removes all trace of that code from the final executable when compiling in release mode ... no overhead!
If you haven't already done so, you might need to switch off the 'detect 64-bit portability issues' option, or live with the warnings it goves when converting char*'s to DWORD's.