Discussion:
[Swig-devel] swig success story (CodeSonar API)
Dave Vitek
2015-02-11 18:33:14 UTC
Permalink
Hi all,

The projects page of the SWIG site suggests emailing this list with swig
success stories. This is a bit belated, but I put up a series of blog
posts about my experience lifting the CodeSonar API (>1000 methods)
using SWIG. The blog post contains some lessons learned about making
memory-safe APIs with SWIG and a little critique about things that were
frustrating (chiefly, the fact that swig is pickier about the order in
which it sees declarations/definitions than the C++ compiler).

This is the part of the blog post that discusses SWIG the most:
http://www.grammatech.com/blog/adding-c-python-java-and-c-bindings-codesonar-api-part-3

Now (half-seriously) we just need a tool for translating doxygen in the
C++ interface into RST (for python) and javadoc.

The blog post glosses over an awful lot of details. Feel free to mail
me if you have any questions, suggestions, or other feedback.

- Dave
William S Fulton
2015-02-12 21:45:57 UTC
Permalink
Post by Dave Vitek
Hi all,
The projects page of the SWIG site suggests emailing this list with swig
success stories. This is a bit belated, but I put up a series of blog
posts about my experience lifting the CodeSonar API (>1000 methods)
using SWIG. The blog post contains some lessons learned about making
memory-safe APIs with SWIG and a little critique about things that were
frustrating (chiefly, the fact that swig is pickier about the order in
which it sees declarations/definitions than the C++ compiler).
http://www.grammatech.com/blog/adding-c-python-java-and-c-bindings-codesonar-api-part-3
Now (half-seriously) we just need a tool for translating doxygen in the
C++ interface into RST (for python) and javadoc.
The blog post glosses over an awful lot of details. Feel free to mail
me if you have any questions, suggestions, or other feedback.
Hi Dave,

That was an interesting blog. I added a link to this blog to
http://swig.org/projects.html.

Doxygen... are you aware that there is a branch that supports reading
doxygen comments and adding them into the target language as pydoc,
javadoc, C# xml docs? This is the next big area I'd like to merge into
the mainline SWIG. See
https://github.com/swig/swig/tree/gsoc2012-doxygen.

I'm not sure what your changes were to support your header files, but
I'd encourage you to batch them up into Github patches for discussion
and possible inclusion into future versions of SWIG.

You are right in that various languages have different levels of
support. You mentioned OCaml, but I'm afraid this is one of the
languages that are not tested on each release as there is no-one
around who is able to understand it and willing to maintain the
language module, so the state of it is unknown.

Your fuzzy testing is very interesting. If you have any standalone
projects that can be used for testing other apis generated by SWIG, I
think it would be good to reference it from or include it with SWIG if
you are able to contribute that.

Java and camelCase... %rename is very powerful in case you hadn't come
across it. Regarding %template names, this is something that needs to
be provided manually, but I'm not sure how one could automatically
provide target language names given template names. Ideas and
implementations welcome!

William
Vadim Zeitlin
2015-02-12 22:40:27 UTC
Permalink
On Thu, 12 Feb 2015 21:45:57 +0000 William S Fulton <***@fultondesigns.co.uk> wrote:

WSF> Doxygen... are you aware that there is a branch that supports reading
WSF> doxygen comments and adding them into the target language as pydoc,
WSF> javadoc, C# xml docs? This is the next big area I'd like to merge into
WSF> the mainline SWIG. See
WSF> https://github.com/swig/swig/tree/gsoc2012-doxygen.

If you (Dave) are interested in Doxygen support, please test the changes
at https://github.com/swig/swig/pull/170 and leave your feedback there.

TIA,
VZ

Loading...