I've defined an object-like macro and a function-like macro (from this question).
#define SYSTEM windows
#define CALL(function, ...) (function)(__VA_ARGS__)
Given this definition, CALL(foo, arg1, arg2)
turns into foo(arg1, arg2)
.
I want CALL(foo, args)
to turn into x__foo(args)
, x
being whatever SYSTEM
is defined to.
I have tried:
#define CALL(function, ...) SYSTEM##__function(__VA_ARGS__)
#define CALL(function, ...) (SYSTEM)##__##(function)(__VA_ARGS__)
#define CALL(function, ...) ((SYSTEM)##__##(function)(__VA_ARGS__)
They all result in compiler errors.
How can I define CALL
so that it concatenates the value of SYSTEM
, __
, and the value of function
?