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

Lists in Python -

android - can not access to progress bar in an other activity -

java - Vaadin 7 Pass Data Between Views -