user1368198
user1368198

Reputation:

Strange multiple class names in Linderdaum Engine

I am trying to use Linderdaum Engine and found there many strange declarations like:

class scriptfinal netexportable ClassName: public iObject

These strange names scriptfinal and netexportable are macros. But they are defined to be empty. Why someone can need this kind of defines?

Upvotes: 3

Views: 119

Answers (2)

molbdnilo
molbdnilo

Reputation: 66371

They're empty so that the C++ compiler won't care about them.

The Linderdaum Engine preprocesses the C++ sources in order to generate meta-information about the classes.

Those macros are most likely used by their preprocessor to generate information for their scripting language (scriptfinal) and .NET serialization code (netexportable).

Upvotes: 3

perreal
perreal

Reputation: 97948

For example, someone might set the scriptfinal macro to:

#define scriptfinal __declspec(dllimport)

to get:

class __declspec(dllimport) ClassName: public iObject {};

Since __declspec is a Microsoft specific extension so normally it is used by macro expansion in portable code. When compiling for the Linux environment the macros are empty so __declspec is not visible to the compiler and under Windows they will be defined as above.

Upvotes: 2

Related Questions