axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Whitlock <>
Subject Autogenerating C bindings (1.5)
Date Wed, 01 Dec 2004 14:13:57 GMT

I'm considering generating the C bindings from the C++ headers using a tool
run during every build.

The trace tool that instruments the code with entry/exit/catch trace
already parses our C++ headers and can parse method prototypes and know
which classes they are in. So it wouldn't be too hard for me to write
another tool that reuses these existing classes that generates the C
headers/implementation for the C bindings. This tool would be run during
every build and what it generated would not be committed to CVS. 90percent
of the work is already done in the trace tool. In fact it may be quicker
and more accurate to write the tool rather than write the headers and
functions manually. The tool would have to make the external C headers
easily human-readable and copy across the comments from the C++ headers.
The tool would also have to cope with special cases like mapping
contructors to create functions, special naming where the same method name
occurs in multiple classes, for instance.

The advantages of using a build tool are...
 - The C headers/implementation are always kept in step with the C++
headers/implementation so they are more accurate.
 - Committers don't have to maintain the C headers/implementation when they
change the C++ headers.

The advantages of manually creating the C bindings and checking them into
CVS are...
 - There is no extra tool to maintain that future committers may not be
familiar with.

Is this a good idea or not?
Mark Whitlock

View raw message