AW: Writing a standalone c preprocessor (like the old cpp) using the cpplib
Andre-Marcel Hellmund
mail@andihellmund.com
Fri Oct 15 16:37:00 GMT 2010
On 10/15/2010 6:13 PM, Oliver Rohe wrote:
>> Sorry for the question, but why do you want to (re)write the C preprocessor
>> yourself? Although the preprocessor logic (libcpp.a) is integrated into the C
>> compiler (cc1) in the meantime, there is still a stand-alone C preprocessr
>> (cpp) which you could use for>your purpose. Or is there any special
>> requirement in your project to NOT use the shipped 'cpp'?
>>
> Thanks for the answer!! I don't have any special requirements, I just need a
> very small application that I can use apart from the whole gcc. So the cpp is
> still a standalone application and uses the libcpp.a?
>
> Can you point me to the main entry point of the cpp module...
>
Hey Oli,
I re-checked and the 'cpp' executable is just another front-end which
finally calls the cc1 C compiler to do the pre-processing. So, to answer
your question is: 'cpp' is not a standalone executable.
But nevertheless, it should be possible to re-use the libcpp.a to create
your own pre-processor. As far as I know, the libcpp isn't (yet) really
designed to be used outside of the gcc world so that you would hardly
find any good API documentation. So, you would have to mainly look at
the C compiler (cc1) how it initializes and uses the functions from
libcpp.a.
Hope that helps,
Andi
More information about the Gcc-help
mailing list