[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] SWIG/C++ Template Expansion Info

From: Michael Dickens
Subject: [Discuss-gnuradio] SWIG/C++ Template Expansion Info
Date: Wed, 29 Aug 2007 22:48:07 -0400

I've always wondered why GNU Radio didn't use C++ templates for gr- blocks (see e.g. the 'gengen' subdirectory in gnuradio-core), since they generally result in much less written code. Might partly be that SWIG only "recently" (as of 1.3.12 or so) added C++ templates to its bag of tricks? Also might be that the SWIG interface is challenging at its best, let alone with something as complex as C++ template expansion / instantiation?

Last week I hacked through both the C++ and SWIG necessities to get template C++ gr-blocks to expand (instantiate) correctly into shared libraries that work correctly with both Python and C++. After much fussing, I wrote a SWIG macro (%define), similar to "GR_SWIG_BLOCK_MAGIC", but for template C++ class expansion into uniquely named GR blocks. While the macro might not work for everyone (or it might, testers would be appreciated), and maybe it's a bit ugly to read, the steps in it make sense according to the SWIG documentation.

If anyone is interested I can provide more information. - MLD

reply via email to

[Prev in Thread] Current Thread [Next in Thread]