Wednesday, April 24, 2013

Something about SWIG



SWIG can generate glue for about a dozen scripting languages.

Here's how how it goes together:

We generate libgnuradio.so, a standard C++ shared library,  that contains the compiled C++ routines.

SWIG reads the .i files and generates two files, _GnuRadioPython.cc
and GnuRadioPython.py, the python wrapper for the low level stuff.
_GnuRadioPython.cc gets turned into yet another shared library
_GnuRadioPython.so

GnuRadio.py is our hand coded top level glue which imports the SWIG
generated stuff plus some other python code required to make it all
hang together.

In python when you

>
>> from GnuRadio import *

GnuRadio.py imports GnuRadioPython.py
... which dynamically loads it's corresponding shared lib _GnuRadioPython.so
... which causes libgnuradio.so to also be loaded to resolve symbols

No comments:

Post a Comment