0

I have exported a C++ class and now i want to use its public member function. how i can do it?

I want to have dynamic binding. My exported class looks like this

#ifdef MAKEDLL
#define DECLDIREXP __declspec(dllexport)
#else
#define DECLDIREXP __declspec(dllimport)
#endif

class DECLDIREXP xyz 
{
public: 
    void printing(); 
    void printing(int a);
};  

using namespace std; 

void xyz::printing()
{
    cout<<"hello i donot take any argument";
}

void xyz::printing(int a)
{
    cout<<"hello i take "<< a <<"as argument";
}
Jonas
  • 6,915
  • 8
  • 35
  • 53
Apoorva sahay
  • 1,900
  • 3
  • 28
  • 45

1 Answers1

0

it seems you are almost there. When building the project generating the dll, make sure MAKEDLL is defined for the linker, and the other way round in projects consuming the dll.

By the way MAKEDLL is probably a bad Name, but MAKEFOODLL if your dll is called foo a better one

sandwood
  • 2,038
  • 20
  • 38