Re: Exporting/importing a variable from a Dll

From: Dan Bloomquist (public21_at_lakeweb.com)
Date: 02/17/05


Date: Thu, 17 Feb 2005 17:27:38 GMT


Richard wrote:

> What if we need to export entire class rather than functions? Is there anyway
> we can export it and retrieve through pointer to a class and use the method
> in that class?

Maybe I'm missing something, but:

class AFX_EXT_CLASS CMyclass
{
};

Exports the whole class. See: 'Exporting and Importing Using
AFX_EXT_CLASS' in the docs.

As for what Joe is talking about, encapsulation is a basic principle in
OOP. It may look silly, but it pays off.

class MyClass
{
protected:
    long myNumber;
public:
    const long GetNumber( ) { return myNumber; }
    void SetNumber( long aNumber ) { myNumber= a Number; }
};

The compiler will inline so there is no real overhead.

Best, Dan.


Loading