Reputation: 31
I know that in C++, classes inherit with the form of class childClass : public parentClass
, and similar variants. However, I was looking through the SFML (a C++ game programming library) header files, and I found this:
namespace sf
{
...
class SFML_API Drawable
{
public :
...
I'm confused about what this means in terms of C++ syntax. A class name can't contain spaces, and there is no colon or any other symbol. What is the meaning of this syntax?
Upvotes: 2
Views: 94
Reputation: 25647
Identifiers written in all caps like this are, by common convention, usually either preprocessor macros or constants.
Given this fact, if you search through the other headers, you may find a line like:
#define SFML_API __declspec(dllexport)
On my own installation of SFML 2.1, I find these lines in Config.hpp:
#define SFML_API_EXPORT __declspec(dllexport)
// ... later...
#define SFML_API_EXPORT __attribute__ ((__visibility__ ("default")))
This __declspec
keyword tells compilers on Windows that the declaration that follows is to be treated as an exported symbol in a shared library. Similarly, the __visibility__
attribute tells GCC-compatible compilers that the symbol is to be visible outside the library. This makes it possible for an application to link to the dynamic/shared library and use its code.
Upvotes: 2