I have a .h file in which hundreds of constants are defined as macros:
#define C_CONST_NAME Value
I need a function that can dynamically get the value of one of these constants.
required function header:
int getConstValue(char * constName);
Is this possible in the C language?
---- EDIT
Thanks for the help, it was fast :)
since I thought there was no miraculous solution for my needs.
The actual header file is generated by the command "SCADE: http://www.esterel-technologies.com/products/scade-suite/ "
From the solution I got from @Chris, is to use some python to generate c-code that does the job.
Now I need to do some optimizations to find the constant name. I have over 5000 O constants (500 ^ 2)
I also look at "X-Macros." The first time I hear about it, it works in C home, because I am not allowed to use C ++.
thanks
source share