c++class

CP_EXPORT in class declaration in C++


What does it mean when a class is declared like this:

class CP_EXPORT CP_Window : public CP_Window_Imp

What does the CP_EXPORT portion mean/imply?


Solution

  • CP_EXPORT is most probably a macro to conditionally export or import the class from a dynamic library.

    For example, when using Visual C++, a macro is used to conditionally select between using dllexport and dllimport. This allows the same header to be used for both the project building the DLL itself and any projects that link against or load the DLL.