GetProcAddress not returning address
I have this code in my dll:
Code:
//mydll.cpp
extern "C"
__declspec(dllexport) LRESULT CALLBACK CallWndProc(int code, WPARAM wParam, LPARAM lParam)
{
//some code
return ::CallNextHookEx(hHook, code, wParam, lParam);
}
When I call:
HMODULE hMod = LoadLibraryA(dll_file);
FARPROC procAddr = GetProcAddress(hMod, "CallWndProc");
It doesn't return the address (I get 0x00000000). But when I remove the keyword "CALLBACK" like so:
Code:
extern "C"
__declspec(dllexport) LRESULT CallWndProc(int code, WPARAM wParam, LPARAM lParam)
{
//some code
return ::CallNextHookEx(hHook, code, wParam, lParam);
}
Then it returns the address. Why is this?
Note: When I created my dll, I didn't use a header file (ie. mydll.h)
Edit: I also want to point out that I am able to call the functions from mydll (in C# using dllimport) regardless of whether I add or remove the keyword "CALLBACK" (OR "WINAPI"), which is bacially __stdcall.