discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Why SWIG has been selected as C++ wrapper for Pyt


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] Why SWIG has been selected as C++ wrapper for Python for GNURadio ?
Date: Fri, 20 Jun 2014 11:42:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Hi Joe,

Disclaimer: I haven't been around when SWIG was introduced into GNU Radio. These are somewhat educated guesses, but since I've had *some* fun with SWIG, I wondered myself and this is what I rationalized.

- SWIG was around at the time GNU Radio was rewritten, which must have been around 2004. I think the choice to use SWIG was made before that [1]. SWIG has been around since '96, so I guess it was expected to be somewhat stable/reliable. Boost.Python was started in '03, and if the guys behind it decided that they had to conceptually rework something, the second year it exists sounds like a dangerous time to use it. ctypes is (I think) python-2.5esque, so this couldn't have been around back in the day, and only does basic C wrapping.
- It does what GNU Radio needed: Generate python wrapper classes without the developers needing to actually write code; defining the interface was enough for a "normal" block to be SWIG'ed, and specialized wrapper classes only had to be written for some of the core things so that things like connect()ing blocks would work. It is arguable if writing and maintaining the SWIG .i files (especially since we're talking about the autohell era) was worth the trouble of avoiding that, but for the only comparable competitor Boost.Python, you had to define wrapper classes, and references to the classes wrapped and their members. Pyrex/Cython now is a complete different language and would have made GNU Radio something much more multi-paradigmatic, whilst adding even more to the "active" codebase that had to be maintained by hand.
- It was expected that if SWIG wasdone right, GNU Radio could end up with multiple scripting language interfaces [2]. Nowadays, people are content to use python, especially since we now (feels like yesterday) have support to write gr::block classes in python, which of course needed a lot of gateway work, so (to my knowledge) there haven't been efforts to make use of more than the C++ and Python SWIG capabilities[3].

Greetings,
Marcus

[1] http://lists.gnu.org/archive/cgi-bin/namazu.cgi?query=SWIG&submit=Search!&idxname=discuss-gnuradio&max=20&result=normal&sort=date%3Aearly
[2] http://lists.gnu.org/archive/html/discuss-gnuradio/2003-03/msg00135.html
[3] After all, for scripting python works really nice and is easy to learn. If you wanted to use a fast Matrix operation in Fortran, there is no stopping you from doing that from C++, which is the programming language of choice for performance-critical blocks, anyway, as long as your Fortran and C++ compilers are ABI-compliant. If you wanted
On 20.06.2014 10:34, Joe D wrote:
Hi All

This is a question intended  for the Software designers and maintainers of
the GNURadio

Is there a specific reason / advantage of using SWIG as a C++ wrapper over
using other avaialble  wrappers  for C++ as Boost.Python , Cython etc ....
in the context of GNURadio ?

Thanks!
Joe



_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

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