GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 20-Apr-2005, 08:30
Maranello Maranello is offline
New Member
 
Join Date: Apr 2005
Posts: 1
Maranello is on a distinguished road

dynamically link my DLL to an application


I am trying to dynamically link my DLL to an application, but I am facing a problem when linking the DLL, can you please help.

My dll header file “MyDllHeader.h” is:

CPP / C++ / C Code:
class A : public CObject
{
public: 
A();
virtual ~A();
int ACCUAPI FunctionX();
int ACCUAPI FunctionY(TCHAR FAR * ParamA );
};

In my application logic is:

CPP / C++ / C Code:
#include "head.h"

typedef int (*MYPROC)();
.
.
.
void CTest2Dlg::OnOK() 
{

HINSTANCE hinstLib;
// Get a handle to the DLL module.
// in the debugging this handler gets a value (i.e. not null)
hinstLib = LoadLibrary(TEXT("Mydll.dll")); 
if (hinstLib != NULL) 
{
// in the debugging “ProcAdd” returns null
ProcAdd = (MYPROC) GetProcAddress(hinstLib, TEXT("FunctionX "));
// If the function address is valid, call the function.
if (NULL != ProcAdd) 
{
// do something
}
}
}

The “hinstlib” returns a value and it is not null, so this means that I managed to load the DLL, but when I call the “GetProcAddress” function to get the address of the function which is in the DLL, it returns null. Kindly help me.
Last edited by LuciWiz : 20-Apr-2005 at 08:44. Reason: Please insert your C++ code between [c++] & [/c++] tags
 
 

Recent GIDBlogToyota - 2008 November Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
High quality link building spogg Search Engine Optimization Forum 7 23-Aug-2006 12:41
gcc-grouping instructions of diff. types for application bravetanveer C++ Forum 1 25-Mar-2005 10:01
Help! Some basal questions about MFC xutingnjupt MS Visual C++ / MFC Forum 1 05-Dec-2004 04:38
php link dbztoolkit MySQL / PHP Forum 4 23-Aug-2003 10:40

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 04:08.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.