Not necessary to export class with only virtual/inline functions?

后端 未结 4 1143
鱼传尺愫
鱼传尺愫 2021-01-19 02:14

In C++ on Win32:

Suppose I have a DLL with a header file that declares a class. The DLL exports some means of obtaining a pointer/reference to an instance of that c

4条回答
  •  不思量自难忘°
    2021-01-19 02:35

    Am I correct in believing that it is not necessary to mark that class as exported using __declspec if one is only going to call virtual or inline functions on its instances?

    Yes,this is correct, and that's what COM do, the DLL only expotys 4 methods, one of them returns to the class factory, which all its members are pure virtual functions.

    Conversely, is it necessary to export the class declaration if one wishes to call statically defined member functions?

    No, just export the static member functions.

提交回复
热议问题