I'm currently having a problem with the definition of a macro in C++.
I want it like this:
#define MY_MACRO (Name, Address) __int32 Get_Name() { return Address; }
Now, when I call it like this:
MY_MACRO(Test, 0x10);
it spits out
__int32 Get_Name() { return 0x10; }
^^^^
instead of
__int32 Get_Test() { return 0x10; }
^^^^
How can I solve this issue? I really need the Get_ in the name, and then the name passed by the argument.
Use the macro concatenation operator.
#define MY_MACRO (Name, Address) __int32 Get_##Name() { return Address; }
You have to concatenate strings this way
#define MY_MACRO(Name, Address) __int32 Get_##Name() { return Address; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With