You must always export constructors and destructors.
![]()
Use _Export or #pragma export in your source files to
specify the classes and functions (including member functions)
that you want to export from your DLL. For example:
class triangle : public area
{
public:
static int _Export objectCount;
double _Export getarea();
_Export triangle::triangle(void);
};
exports the getarea method and the constructor for class triangle. Alternatively, you could use #pragma export:
#pragma export(triangle::objectCount(),,1) #pragma export(triangle::getarea(),,1) #pragma export(triangle::triangle(void),,2)
In
Windows, you can also use __declspec to export the static data objectCount :
class triangle : public area
{
public:
static int __declspec(dllexport) objectCount;
double _Export getarea();
_Export triangle(void);
};