If I use loadlibrary to load a dll, how would i import its functions
i.e.
dllname = pak.dll
extern "C" void EXPORT SetValue ( float version )
Is the name in the dll :o?
The full procedure run-down would be greatly appreciated :p
thanks
Printable View
If I use loadlibrary to load a dll, how would i import its functions
i.e.
dllname = pak.dll
extern "C" void EXPORT SetValue ( float version )
Is the name in the dll :o?
The full procedure run-down would be greatly appreciated :p
thanks
Code:#include <windows.h>
// typedef return_type(calling_convention *pfFunctioName)(arguments)
typedef void(__cdecl *pfSetValue)(float);
int main()
{
// SetValue is a pointer to a function
pfSetValue SetValue;
// Load the dll
HMODULE hPak = LoadLibrary("pak.dll");
// Check to make sure it worked...
if (!hPak)
{
MessageBox(NULL, "Failed to Load Library", "Error", MB_OK);
return 1;
}
// Find the address of the function
// (note that the name may be mangled if this is a c dll)
SetValue = GetProcAddress(hPak, "SetValue");
// Check to make sure it worked...
if (!SetValue)
{
MessageBox(NULL, "Failed to Find Address", "Error", MB_OK);
return 1;
}
// call the function just like any other function.
SetValue(42.1);
return 0;
}
thanks heaps!