You can get the preprocessor output from most C / C ++ compilers using the -E option on the command line, for example,
g++ -E my_file.c -o my_file_preproc.c
objcopy is an easy bet, but today I came across an ELF resource compiler and it may be useful for you. It allows you to embed everything you want into an ELF file, and even generate C / C ++ code so you can add it. That way, you can even create a library with which your code could link to it to print the source for the executable directly from the executable.
Which brings up another idea ... and not just include all the pre-processed source code, you could provide the executable with the option to print the equations used.
source share