At Sat, 15 Mar 2003 18:57:56 +1300 (NZDT), Andrew McNaughton wrote: > On Fri, 14 Mar 2003, David Fitch wrote: > > On Fri, Mar 14, 2003 at 04:14:28PM +1100, Broun, Bevan wrote: > > > It would seem that it's worth while buying the Perl CD bookshelf. > > > > ah thanks, got that book already
I found the existing XS manpages fairly good to learn from. Like anything else, I had to look at some "real world" examples before learning some of the evil tricks. If you have the choice, I suggest reading the perl5.8 versions of the manpages, since they are a little more comprehensive (particularly "perlapi"). Skip over the bits about unicode and threading, they (mostly) don't apply to pre-perl5.8. > Besides using XS directly, you might want to consider using SWIG or h2xs > to generate the XS code, or perhaps you might want to use Inline.pm to > inline your C code into your perl. > > All of these approaches can be quite simple when you're dealing with > simple data types at the interface, but get more involved where you need > to work with perl's data types. yes, I should have mentioned these. I've never used either SWIG or Inline.pm - but from what I know of them: SWIG is good in that it allows you to write the SWIG wrapper code once, and use that for all sorts of high-level languagues (eg: guile, perl, python). From what I read of it years ago - it did this by providing a lowest-common-denominator interface. Fine if you only have a simple library - bad if you want to provide access to semi-complicated data structures, or in general provide a "more perlish" experience for your users. Inline.pm is the go if you only have a small set of functions that you just want to use yourself (not distribute on CPAN or something). Real easy to use - good for optimising a particular chunk of code, or calling a single C function to do something that can't be done by perl itself; not so good for providing a library interface that will be directly accessible to "outside" code. -- - Gus -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
