In the current state of gr-howto (which is also used in gr_modtool), the
SWIG stuff is done pretty intelligently by using the header files as
.i-files, which means there is no need to write a SWIG header for every
block.
One advantage of this was the possibility to add stuff in the .i-file
which weren’t in the .h-file; specifically, exception specifiers.
Example (from gr-specest, specest_welch.i):
GR_SWIG_BLOCK_MAGIC(specest,welch);
specest_welch_sptr
specest_make_welch(unsigned fft_len, int overlap, int ma_len, bool
fft_shift, const std::vector &window)
throw(std::invalid_argument);
// And so on .
If I don’t declare the exception specifier, I can’t catch the exception
in Python. If I simply include specest_welch.h in specest_swig.i, I need
to add the specifiers in the C+±code, which is not very popular (and I
think not future-compatible, and gcc doesn’t handle that well).
Here’s my question: is there a cool way to have SWIG know about the
exceptions without having to write a .i-file for every block that uses
exceptions? Can I ‘tag’ the source code in a way that gcc doesn’t care,
but SWIG does?
Thanks for any nice ideas!
MB
–
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)
Dipl.-Ing. Martin B.
Research Associate
Kaiserstraße 12
Building 05.01
76131 Karlsruhe
Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu
KIT – University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association