I am trying to understand a C++ code that reads a dll explicitly.
Does any one know how the line #define LFE_API(name) LFE_##name name
below actually works?
I understand #define LFE_API(name) LFE_##name
but get confused about the last "name".
struct Interface
{
# ifdef LFE_API
# error You can't define LFE_API before.
# else
# define LFE_API(name) LFE_##name name
LFE_API(Init);
LFE_API(Close);
LFE_API(GetProperty);
# undef LFE_API
# endif
};
Since the first part of the macro (LFE_##name) just concatenates both parts, a call to LFE_API is creating a variable named name with the type LFE##name, such as:
LFE_API(Init) expands to LFE_Init Init;