Home > Mobile >  how do i solve this metaprogramming problem?
how do i solve this metaprogramming problem?

Time:12-19

i have a c file and i want to be able to do something like

init() {
  //do stuff
}

and have a parser of some kind give it an unique name and add it to a section inside a linker script or other files.

the first part can be achieved with the gnu preprocessor, but the second one can't.
i've tried using m4, but it doesn't allow whitespaces between macro and the parentheses.

my environment is just make so i can run stuff before compiling.
how can i achieve this in a crossplatform way?

CodePudding user response:

The only decent solution i found was making my own parser. (using flex)

  • Related