C++ Binding Generator
Abdulhaq
alynch4047 at gmail.com
Mon Feb 17 10:47:54 PST 2014
On Monday, 17 February 2014 at 09:46:15 UTC, Andrej Mitrovic
wrote:
>
> Nice. I've had a codegen project before which is currently
> stalled:
> https://github.com/AndrejMitrovic/dgen
>
> Some docs I wrote about peculiarities of wrapping C++:
> https://github.com/AndrejMitrovic/dgen/wiki
Interesting reading, it seems we've run into the same problems
(not surprising I suppose) and even come up with the same
solutions (virtual functions, return-by-value).
>
> Unfortunately the tool has a long history, it went through
> several
> rewrites. From basing the typeinfo extracted from doxygen
> (initially
> the tool was only supposed to be used to generate wxWidgets
> bindings),
> to later basing it on GCCXML, to later forking GCCXML and
> adding my
> own features (https://github.com/AndrejMitrovic/gccxml), to
> finally
> realizing I won't be able to get all C++ typeinfo from GCCXML
> because
> it's based on an old GCC parser. It was an uphill battle.
>
> Ultimately I would have to re-purpose the tool to use Clang.
>
> I did have some initial success. I've managed to autowrap the
> TagLib
> C++ library, some small XML libraries, but ultimately the tool
> needs
> proper typeinfo that GCCXML doesn't provide.
>
> Clang itself has a C API, but from what I've read online it
> doesn't
> export enough C++ typeinfo either, so I'd have to use the Clang
> C++
> interface instead (maybe libtooling or something of that sort).
>
I feel your pain! Because my main target library was Qt I was
able to bypass the whole typeinfo extraction issue by basing the
binding generator on sip files and then primarily using the PyQt
sip files - with the penalty that the PyQt wrapping will
therefore be GPL. However, seeing how hard it can be to extract
the typeinfo automatically (and the object ownership information
still will need to be done manually) I'm very glad that I fell
into doing it that way. A feature evolution for me would be to
try and bolt on an automated typeinfo extractor front end.
Riverbank already have one for generating sip files but it's
practically undocumented and hard to use.
> I might get back to working on that tool one day, I don't know
> yet.
> I've got a big queue of things to work on.
Same here - so much to do and so little time! If I'm not careful
I end up with analysis paralysis and just browse HN and these
forums instead of catching up on my reading list or coding
something up. Speaking of which....
More information about the Digitalmars-d
mailing list