I have a c++ class that I've defined in a header file testclass.hpp the code works fine in as an .exe now I want to use it for a dll and I don't know how to do it I visted MSDN site and did what they tell there but in didn'T help , any idea how to do this. here a code example :
#ifndef TESTCLASS_H
#define TESTCLASS_H
#include <iostream>
class Test{
private:
int variable1;
int variable2;
public:
Test(float,int);
~Test();
void doStuff();
int getstuff();
};
#endif
and this is what I tried :
#ifndef TESTCLASS_H
#define TESTCLASS_H
#ifndef TESTCLASSDLL_EXPORTS
#define TESTCLASSDLL_API __declspec(dllexport)
#else
#endif
#define TESTCLASSDLL_API __declspec(dllimport)
#include <iostream>
class Test{
private:
static __declspec(dllexport) int variable1;
static __declspec(dllexport) int variable2;
public:
TESTCLASSDLL_API Test(float,int);
TESTCLASSDLL_API ~Test();
TESTCLASSDLL_API void doStuff();
TESTCLASSDLL_API int getstuff();
};
#endif