I am trying to create a macro (C/C++) to dynamically create a function. Basically I have a function whose name varies in the "MyClassA" part. Also the arguements should be passed through the macro definition. Then there is a variable method call within the function, for instance "methodForClassA", again with a variable set of arguements.
void Java_somepackage_MyClassA_fixMethod(int arg1, int arg2) {
Toolbox.methodForClassA(arg1, arg2);
}
There are more than 40 functions with this pattern. Of course I can create them manually or with a script. But is it also possible to do this with a macro? For instance something like this (which does not work):
# define MACRO_TEST(classname, methodname, args, argsMethod) void Java_somepackage_##classname_fixMethod(##args) {\
Toolbox.##methodname(##argsMethod);\
}
MACRO_TEST(MyClassA, methodForClassA, args1, args2)
After some experimentation and reading of docs, I could only find out how to create "dynamic" function names with patterns where a "(" follows the dynamic part:
#define FUNCTION(name, x) int func_##name() { return x;}
FUNCTION(test, 2);
Regards,