
hparse

Parse function signatures for FFI from gcc4 -fdump-translation-unit
Also parses record types (union, struct) if used as arguments of the used functions.
Note that the output should be compiler independent. So you CAN use gcc for creating FFI signatures for shared libraries compiled with other compilers. Theoretically.

hparse.pl [OPTIONS] [header] [function-regex] hparse.pl stdio.h '^fprintf$' hparse.pl --code "int __cdecl ioctl (int __fd, int __cmd, ...)"

-t FFI-TYPE - dump in the given FFI format (todo) --cc gcc - use given gcc -I - use given include path --code string - parse string, not any header --file file - parse file, not any header
* C::DynaLib * FFI * Win32::API * P5NCI * Ctypes

frexp return=double parms=double, *int, void align=8, return-align=64
frexpf return=float parms=float, *int, void align=8, return-align=32
frexpl return=long double parms=long double, *int, void align=8, return-align=32
free return=void parms=*void, void align=8, return-align=8
freopen return=*FILE parms=const *char, const *char, *FILE, void align=8, return-align=32
fread return=size_t parms=*void, size_t, size_t, *FILE, void align=8, return-align=32
poll return=int parms=struct pollfd *, nfds_t, int, void align=8, return-align=32
struct pollfd (align=32) { int fd (align=32) short int events (align=16) short int revents (align=16) }

Resolve size_t, nfds_t => integer_type
Calling convention _stdcall, _cdecl, _fastcall
Align syntax for the FFI's?
Varargs ... not detected
./hparse.pl --code "int __cdecl ioctl (int __fd, int __cmd, ...);" ioctl
ioctl
return=int
parms=int, int
align=8, return-align=32