Hello,
I am using Dev c++ to create a dll in c++ on windows xp pro. It provided me
with a template and I added a simple function to return an int as a test.
It compiled the dll ok and I added a reference to a Visual basic 6 project,
yet when I call it VB complains about run time error 453, "cant find dll
entry point 'funcname'". Can anybody show me what I am doing wrong, do I
need to create a definition file and if so how?
I have included the declaration in VB and the c++ code below:
Thanks for any help or advice.
Private Declare Function runme Lib "d:\c++programmingtest\\test.dll" () As
Integer
dll.h file:
#ifndef _DLL_H_
#define _DLL_H_
#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */
class DLLIMPORT DllClass
{
public:
DllClass();
virtual ~DllClass(void);
int runme(void);
private:
};
#endif /* _DLL_H_ */
dllmain.cpp file:
/* Replace "dll.h" with the name of your header */
#include "dll.h"
#include <windows.h>
DllClass::DllClass()
{
}
DllClass::~DllClass ()
{
}
int DllClass::runme() {
return 9000;
}
BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being
called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
/* Returns TRUE on success, FALSE on failure */
return TRUE;
}