Reputation:
So I'm looking at the Ogre Character sample, and there's a class which is declared as
class _OgreSampleClassExport Sample_Character : public SdkSample
The classes identifier is Sample_Character and it is derived from the SdkSample class. What is the _OgreSampleClassExport though?
Upvotes: 0
Views: 81
Reputation: 20063
On Windows platforms _OgreSampleClassExport
is a macro used to specify the DLL linkage of a class' members. If the macro expands to __declspec(dllimport)
the members exist in an external DLL and must be imported. If it expands to __declspec(dllexport)
the members exist in the DLL being built and will be exported. If the macro is blank the members will be linked statically and do not exit in a DLL.
On other platforms it works in much the same way. On Linux when compiling with GCC the macro expands to __attribute__ ((visibility("???")))
where "???" specifies the linkage in a similar fashion as that used in to __declspec()
.
Upvotes: 3
Reputation: 787
This post seems relevant - Macro variable after class keyword
Essentially, it allows for the class to be exported to support a dynamically-linked library.
Upvotes: 1