c++ - Macro before class name -


i looking on code , i've stumble upon this:

class idata_export idata {     /* .... */ } 

where idata_export not more :

#ifndef idata_export     #define idata_export #endif 

what idata_export in case? (i mean, type int, char etc ... ?)

most @ point in time, or under conditions defined (for example, under msvc):

#define idata_export __declspec(dllexport) 

which used indicate classes publicly export library.

using macro, developer alternate between exporting classes , not exporting anything, without having go on each individual class.

this part of macro pattern alternates between importing , exporting classes, depending on whether code compiled library, or program dependent on library. like:

#ifdef is_library // <--this defined when compiling library!    #define idata_export __declspec(dllexport)   #else    #define idata_export __declspec(dllimport)   #endif 

for more information, see dllexport, dllimport on msdn


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -