CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13

Threaded View

  1. #1
    Join Date
    Aug 2005
    Location
    Netherlands, The
    Posts
    2,184

    problem retrieving own created DLL procedure address

    i have to solve this prooblem now before i can solve my other problem..

    so here it is:

    Code:
    		this->hModule = ::LoadLibrary(sModule);
    		if(!this->hModule)
    			return false;
    		this->pCreate = (bool(*)(HWND))::GetProcAddress(this->hModule, "Create");
    		if(!pCreate)
    			return false; // we returned false here
    		this->pDestroy = (void(*)())::GetProcAddress(this->hModule, "Destroy");
    		if(!pDestroy)
    			return false;
    		this->pMove = (void(*)(int, int, int, int))::GetProcAddress(this->hModule, "Move");
    		if(!pMove)
    			return false;
    		if(!this->pCreate(this->Handle()))
    			return false;
    		return true;
    my code cannot retrieve the function Create from my DLL.
    the dll is:
    Code:
    #ifdef BUILD_DLL
        #define DLL_EXPORT __declspec(dllexport)
    #else
        #define DLL_EXPORT __declspec(dllimport)
    #endif
    
    bool DLL_EXPORT Create(HWND hParent);
    void DLL_EXPORT Destroy();
    void DLL_EXPORT Move(int iX, int iY, int iW, int iH);
    
    #include "CView.hpp"
    Code:
    #include "main.hpp"
    
    	CAppView AppView;
    
    	bool Create(HWND hParent)
    	{
    		return AppView.Create(hParent);
    	}
    
    	void Destroy()
    	{
    		AppView.Destroy();
    	}
    
    	void Move(int iX, int iY, int iW, int iH)
    	{
    		AppView.Move(iX, iY, iW, iH);
    	}
    i think i did something wrong. i checked if BUILD_DLL is defined. i checked if i loaded the right module. both are true. so i dont understand why i cannot retrieve the procedure adress of Create. i will try some EXPORT TABLE viewer to check some things.

    i checked with export viewer:
    Code:
    _Z6CreateP6HWND__ (Ordinal: 2, Entry Point RVA: 12f4h (4,852))
    so i still dont know why it fails to retrieve
    Last edited by Mitsukai; September 14th, 2008 at 04:30 PM.

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

Featured