I have main executable and two functions that are dereferenced to DLL.
class CPluginInterface
{
public:
virtual void A(void) = 0;
virtual void B(void) = 0;
};
I created DLL like this
//Main.h
#include "Function.h"
class CForward : public CPluginInterface
{
public:
//void A(void);
void B(void);
};
//Main.cpp
#include "Main.h"
/*void CForward::A(void)
{
//A Function is commented because it is not used
}*/
void CForward::B(void)
{
//Do something here
}
extern "C"
{
// Plugin factory function
//void __declspec(dllexport) __cdecl A(void) { }
void __declspec(dllexport) __cdecl B(void) { }
}
However the program is crashed because A(void) doesn't exist when the main executable dereferencing it. How to skip A(void)?
If I create the DLL like this, it works fine.
//Main.h
#include "Function.h"
class CForward : public CPluginInterface
{
public:
void A(void);
void B(void);
};
//Main.cpp
#include "Main.h"
void CForward::A(void)
{
//Do something here
}
void CForward::B(void)
{
//Do something here
}
extern "C"
{
// Plugin factory function
void __declspec(dllexport) __cdecl A(void) { }
void __declspec(dllexport) __cdecl B(void) { }
}
NB: I create Plugin Interface.