[Saltlake-pm] November meeting recap

David Oswald daoswald at gmail.com
Wed Nov 13 13:36:01 PST 2013


And the slides are at:
http://www.slideshare.net/daoswald/getting-started-with-perl-xs-and-inlinec

I'll post a link to both on the website when I get a chance.

One correction: I mentioned that the C++ "Boost::Graph" library had
been wrapped in XS to produce the CPAN "Boost::Graph" module.  This is
correct.  But I was incorrect in how this wrapping was done.  I can't
find any definitive reference to the module's author using the
AUTO_WRAP tool from Inline::C.  There are other modules that have used
this feature.  I'll try to see if sisyphus (Inline::C maintainer)
knows which modules used AUTO_WRAP.  It's certainly convenient though.

Also someone asked about memory leakage when wrapping C libraries.
The most common issue in this regard is when wrapping a library where
one function allocates memory, but never calling the function that
deallocates it; it would be a bug for a C programmer to do the same
thing.  And in most cases if Inline::C is able to use a native typemap
to convert a data type, which is often the case for wrapped functions,
the user doesn't need to worry about memory leaks.  The most common
leaks occur when the XS programmer takes control over moving Perl data
structures (SV's, AV's, HV's) back and forth using the stack
(implicitly or explicitly).  In these cases, it's important to keep
track of which XS functions increment the reference counter and which
don't.  The calling code owns a reference count, so it's important
that the XSUB doesn't retain a ref count.

Hope this clarifies, though to be honest, consulting the docs
frequently and looking at good examples such as List::MoreUtils,
List::BinarySearch, Scalar::Util, List::Util, etc... prior art is
sometimes better than the wall of documentation when it comes to
understanding how to accomplish things.

Dave

On Wed, Nov 13, 2013 at 1:47 PM, Doran L. Barton <fozzmoo at gmail.com> wrote:
> On Tue, 12 Nov 2013 22:30:36 -0700
> David Oswald <daoswald at gmail.com> wrote:
>
>> We had a good turnout this evening.  I didn't get a count, but the
>> room was full.
>
> There were 11 or 12 people there. There was only one empty chair. Great
> work, Mongers.
>
> Here's the video: http://www.youtube.com/watch?v=l0wvw3XAB2c
>
> --
> Doran L. Barton <fozzmoo at gmail.com> - Linux, Perl, Web, good fun, and more!
>  "Please do not wash hair or clothes in toilet."
>     -- Seen in a Tokyo restroom
> _______________________________________________
> Saltlake-pm mailing list
> Saltlake-pm at pm.org
> http://mail.pm.org/mailman/listinfo/saltlake-pm
> http://saltlake.pm.org



-- 

David Oswald
daoswald at gmail.com


More information about the Saltlake-pm mailing list