What does this kind of C++ class declaration mean?

后端 未结 3 2052
野性不改
野性不改 2021-01-24 07:08

I downloaded Ogre3D source code, and found this kind of class declaration:

class _OgreExport TimeIndex
{ ...

I know \"TimeIndex\" is the class

3条回答
  •  离开以前
    2021-01-24 07:16

    _OgreExport is a preprocessor directive that expands to either

    __declspec(dllimport)
    

    when the file is included outside its module or

    __declspec(dllexport)
    

    otherwise. Under Windows, you have to specify which classes/methods you want exported/imported so that they can be used across binaries.

    Technically, as James pointed out in the comments, the macro name is illegal, since it begins with an underscore. These names are reserved for the implementation.

提交回复
热议问题