Is there any way to unstringify strings provided as macro arguments? I need to be able to call functions who's names are in strings. Something like this:
void hello() {
printf("Hello, world!");
}
call_func("hello");
How would I implement call_func. It would be in a module that would be #include
d and would be used to call functions in the main c file. If there is another way to do this where the name wouldn't have to be in strings but could be passed as an argument to a function that would be ok to. This is what I mean:
#define call_func(X) X()
void do_something(Some_kind_of_C_func_type i) {
call_func(i)
}
void hello() {
printf("Hello, world!");
}
do_something(C_FUNC(hello));