
Sebastian Redl wrote:
I think the most promising idea would be to combine an existing special representation (e.g. that of Synopsis) with a custom gcc frontend and embed the gcc backend into a library. Intercept the output. A custom linker that is able to link with a running application would probably be needed.
I second what David said: just use the system compiler / linker to produce a DSO and load that into your process. Anything else is going to be much more complex. And, I don't see why you would need Synopsis *and* a custom gcc frontend (such as gccxml). You can generate a parse tree (etc.) with synopsis alone, process it either in C++ or python to generate new code, then call a system (or custom) toolchain to compile that into a loadable module. If you are doing all this in python you don't even need to care about ABI compatibility issues.
Then the only remaining problem is that GCC's license is incompatible with Boost's.
Not a problem if you don't *link* with gcc code (synopsis is distributed under LGPL). Regards, Stefan