hi everyone i need to build a c++ project that exports functions to c project this is my c++ class :
** MyCppClass.h **
class MyCppClass
{
public:
static void MyCppMethod()
}
** MyCppClass.cpp **
void MyCppClass::MyCppMethod(){}
*now i need to create an interface for the Method MyCppMethod (static).
i did that : ** MyExport.h**
#define Export __declspec(dllexport)
extern "C" void Export MyCppMethodWrapper();
** MtExport.cpp**
#include "MyCppClass.h"
#include "MyExport.h"
void MyCppMethodWrapper() { MyCppClass::MyCppMethod();}
thats it !
now the C part (different project)
i linked the project with MyExport.lib
** program.c**
#include "MyExport.h" ->does not compile because of the extern "C"
int main()
{
MyCppMethodWrapper();
}
if i do not add the line : #include "MyExport.h"
at program.c the program compiles and work fine but i need to provide an header for the exports (the client needs the header) and i want to make the program use that header. how can i resolve that ???
thanks for your answers