This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Calling compiler from C program...
- From: Johann Klammer <klammerj at a1 dot net>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 08 Nov 2012 17:41:04 +0100
- Subject: Calling compiler from C program...
Hello,
Some compilers feature function call interfaces for on-the-fly
compilation (C# and lcc).
Now I wonder if this is possible with gcc. Is there a documented/stable
interface for compiling snippets of C code programatically from inside a
C program? If not, how much work would it involve? Would it be possible
to do certain initialisation steps only once? Does gcc leak memory?
Would it be able to run for extended periods of time, without having to
end the process? Which parts of the compiler are reentrant/thread safe?
Is the state nicely encapsulated or strewn across loads of globals/statics?
Best regards,
JK