5

Suppose I have a C++ header fun.hpp:

//existing description of what fun1 does
void fun1(int x);
//existing description of what fun2 does
void fun2(int x);

I want to generate a SWIG wrapper so that the comments will appear in the target language with:

  1. in a separate HTML document
  2. embedded in the target generated wrapper code

Any ideas?

4
  • What language are you targeting with SWIG? Java? Python? It's sort of ugly and unsupported, I think someone is working on the more general problem though. Commented Sep 14, 2012 at 13:20
  • D although it shouldn't matter: the "hard" part should be associating C++ comments to the appropriate function/variable; given those it should be straightforward to generate comments for the target language IMHO. Commented Sep 14, 2012 at 20:27
  • I agree it shouldn't matter, but the current state of play seems to be a GSOC branch for Doxygen->JavaDoc, a bodge with %javamethodmodifiers and some limited docstring support for Python. Commented Sep 16, 2012 at 15:05
  • I can associate the function-variable comment when they are inline and happens in the same line. I think comments like, // @default(10) @format(%d) can be used to hint code generation. But currently the swig parse tree does not have the comments.
    – KRoy
    Commented Nov 3, 2017 at 20:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.