[BangPypers] SWIG

bhaskar jain bhaskar.jain2002 at gmail.com
Tue Sep 15 04:56:26 CEST 2009

Thanks for the response.

What i faced was intentionally passing unexpected/nonsense data cause
segmentation fault in one case. Was wondering if this is because of SWIG or
because of the underlying library (which in turn uses glib). But the
underlying library looks ok. Have you faced such issues while working with
SWIG. Is it reliable to be used in production level code which will be
pretty load intensive.

Also who frees the pointers in case of python binding? Some functions say
the caller should free the pointer but in case of python binding  does the
python memory manager frees it using the standard reference count.

I believed the interface file (.i file) has to be hand-written. Can you
please elaborate on the Makefile approach.


On Tue, Sep 15, 2009 at 12:25 AM, Gora Mohanty <gora at srijan.in> wrote:

> On Tue, 15 Sep 2009 00:04:01 +0530
> bhaskar jain <bhaskar.jain2002 at gmail.com> wrote:
> [...]
> > Problem is that there was a bug and they have changed a few lines
> > in one of the C files. So my question is - will just applying the
> > patch and installing the library again, will i get a fresh good
> > python binding or do i need to regenerate the wrapper_ *.c files
> > using SWIG.
> It depends on what was changed, but it is best to regenerate
> everything. Is this that much of a concern in terms of time,
> etc. It is quite easy to set up a Makefile to do this.
> > Any tips in working with SWIG, using the python bindings will be
> > appreciated. Also is it a frequent problem of segmentation faults
> > using the python bindings of C programs which employ lot of
> > pointers. Sorry, I am new to SWIG.
> >
> > Is it advisable to use SWIG at all?
> [...]
> I would enthusiastically advocate SWIG, but have had arguments with
> people who take a different view, and whose opinions I respect. The
> best counter-arguments I have heard is cleanness of the generated
> code, and efficiency, but at least for a non-pedal-to-the-metal
> coder like me, SWIG definitely does the job. So, I would say that
> if you can take a look at the generated SWIG code, and think that
> you can do better, please do that, and contribute your approach
> back to SWIG.
> Regards,
> Gora
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20090915/8a822427/attachment-0001.htm>

More information about the BangPypers mailing list