I have this code in my dll:
When I call:Code://mydll.cpp extern "C" __declspec(dllexport) LRESULT CALLBACK CallWndProc(int code, WPARAM wParam, LPARAM lParam) { //some code return ::CallNextHookEx(hHook, code, wParam, lParam); }
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:
Then it returns the address. Why is this?Code:extern "C" __declspec(dllexport) LRESULT CallWndProc(int code, WPARAM wParam, LPARAM lParam) { //some code return ::CallNextHookEx(hHook, code, wParam, lParam); }
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.


Reply With Quote