Results 1 to 1 of 1

Thread: GetProcAddress not returning address

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    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.
    Last edited by benmartin101; Aug 7th, 2011 at 11:17 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width