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

后端 未结 4 1137
鱼传尺愫
鱼传尺愫 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:26

    Am I correct in believing ...

    Yes I think so, but:

    • You should test that (I can't at the moment)

    • You might want to beware using inline methods: because if you change them later then you ought to rebuild every other component which depends on (has been built with) this class (i.e. the DLL is no longer at all well-insulated or self-contained ... inline methods are OK within a single DLL, but conducive to a kind of 'DLL hell' if used in a DLL's exported interface).

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

    If not the whole class, you need to export at least those individual static methods.

提交回复
热议问题