Peter Peter - 4 years ago 633
C Question

Extracting C / C++ function prototypes

I want to do this:

extract_prototypes file1.c file2.cpp file3.c

and have whatever script/program print a nice list of function prototypes for all functions defined in the given C / C++ files. It must handle multi-line declarations nicely.

Is there a program that can do this job? The simpler the better.

EDIT: after trying to compile two C programs, bonus points for something that uses {perl, python, ruby}.

Answer Source

The tool cproto does what you want and allows to tune the output to your requirements.

Note: This tool also only works for C files.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download