codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  dynamically link my DLL to an application  maranello at 07:34 on Tuesday, April 19, 2005
 

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:

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

In my application logic is:

#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.










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime
•  help me
•  pls help me with this..
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem
•  Re: import contacts of msn/yahoo


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007