I'm looking for a clean way to achieve something:
First, I have a bunch of functions foo1, foo2, bar1, bar2, etc.
Next, I want each function to have some metadata bundled with it in a way that can be read at runtime and used when each function is called. I'd also like the metadata to be defined alongside the function to keep things from getting out of sync during refactoring, as well as for easy perusal of the source.
Originally I planned on a struct with both the metadata and a function pointer containing a lambda defining the function right there in the struct. However this hit a snag...The metadata structs are static (one copy per library), and the functions are generic - and only made concrete by consumers of the library, ergo no function pointers.
I've been experimenting with macros, and maybe that's the best way to go.