Search code examples
c++objective-ccocos2d-x

Meaning of "CC_DLL" in this line"class CC_DLL CCSize" in Cocos2d-x


What is the specification of CC_DLL in this line"class CC_DLL CCSize" in Cocos2d-x.
Every Class in cocos2d-x Define like that --> class ..... classname
It create confusion for me. Plz help me out.

Thanks,


Solution

  • It's probably a preprocessor definition telling the module to either export or import the class.

    Something like:

    #ifdef BUILDING_COCOS
    #define CC_DLL _declspec(dllexport)
    #else
    #define CC_DLL _declspec(dllimport)
    #endif
    

    When linking against the library, BUILDING_COCOS is not defined, so CC_DLL will mean _declspec(dllimport), which tells the compiler that the class is exported in a binary.