You can use the -dump
option of the abi-compliance-checker tool to parse signatures of functions and methods from your header file(s):
abi-compliance-checker -lib NAME -dump DESC.xml -headers-only -stdout > api.dump
XML-descriptor (DESC.xml
) is the following:
<version>
VERSION
</version>
<headers>
/path(s)/to/headers/
</headers>
The tool works as following:
- Call
GCC
with -fdump-translation-unit
and a set of automagically generated -I...
options on the headers specified in the input XML-descriptor;
- Parse the AST dump generated by the
GCC
;
- Generate function signatures and type definitions in the Data::Dumper or XML format (if additional
-xml
option is provided).
The sample signature of int BZ2_bzRead ( int *bzerror, BZFILE *b, void *buf, int len )
function from bzlib.h
header looks like:
'228' => {
'Header' => 'bzlib.h',
'Line' => '160',
'Param' => {
'0' => {
'algn' => '4',
'name' => 'bzerror',
'type' => '30'
},
'1' => {
'algn' => '4',
'name' => 'b',
'type' => '16'
},
'2' => {
'algn' => '4',
'name' => 'buf',
'type' => '68'
},
'3' => {
'algn' => '4',
'name' => 'len',
'type' => '41'
}
},
'Return' => '41',
'ShortName' => 'BZ2_bzRead'
},