Generating glue code from C header files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Generating glue code from C header files

Jan Vrany-2
Hi,

a few months ago, we have been talking about problems
with interfacing big C libraries with huge amonunt of functions
and types.

I found very interesting tool - GCCXML
(http://www.gccxml.org/HTML/Index.html).

It generates XML output from given C (resp. C++) header.
Cool thing is that this tool is implemented as
GCC backend, so it can parse everything that GCC can.

Once xml is generated, one can write XSL stylesheet to generate
customized interface code. I've been playing with those tools
and I wrote (incomplete) XSL stylesheet for creating inteface
code for Smalltalk/X (I'm creating interface for APR ans subversion
libs).

Generated XML headers as well as XSL stylesheets can be found at
http://moon.felk.cvut.cz/~vranyj1/download/stuff/libapr/
It is nothing more than result of one-evening experiment,
but it looks quite good, I thing.

Main disadvantage of GCCXML is that it operates on
preprocessed source, so all macros are lost. This
could result in some troubles when used with libraries
that uses macros a lot (as GTK+ :-)

However, it might be better solution than AWK/SED scripts.

Cheers,

Jan



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Generating glue code from C header files

Paolo Bonzini

> a few months ago, we have been talking about problems
> with interfacing big C libraries with huge amonunt of functions
> and types.
>
> I found very interesting tool - GCCXML
> (http://www.gccxml.org/HTML/Index.html).

Hi Honza,

GCCXML is indeed interesting (it would be even more interesting if it
was distributed as a patch against GCC mainline).  Unfortunately, the
fact that it works on preprocessed source code is a main hindrance to
its usage for this purpose.

You may want to take a look, on the other hand, at the XML output mode
of SWIG.

Ciao,

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk