AW: Writing a standalone c preprocessor (like the old cpp) using the cpplib
Kevin P. Fleming
kpfleming@digium.com
Fri Oct 15 22:51:00 GMT 2010
On 10/15/2010 11:36 AM, Andre-Marcel Hellmund wrote:
> 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.
Or you could use 'mcpp', which is a library designed solely for the
purpose of producing a C pre-processor, and which comes with a tiny
example application that can be compiled into that and that alone.
--
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kfleming@digium.com
Check us out at www.digium.com & www.asterisk.org
More information about the Gcc-help
mailing list