Inline::C has a somewhat less vertical learning curve than straight XS, and also has generally useful cookbook.
In any case, the typemap declarations are what you want to look at for data type passing. It may be most direct to look at an example typemap from some C library wrapper module, and compare it to the library's headers and EXTERN.h, perl.h, and XSUB.h.
After Compline, Zaxo
| [reply] |
<toot>Getting Started with Inline::C</toot>
But for more completeness check out manning's extending and embedding perl (link below in MZSanford's node). It is "dense" - in a good way - and definetly delves deep into the internals. You can also check out Advanced Perl Programming - especially chapters 18,19, and 20.
-derby
| [reply] |
I suggest Extending and Embedding Perl (Pub: Manning , Auth: Jenness, Cozens) ... a great book on the subject. I recently read this after picking it up, and found that it filled in the gaps i found left by the standard docs.
from the frivolous to the serious | [reply] |
I second that suggestion, Great Book! It fills the gaps for Advance Perl Programming, although I recommend that book as
well.
| [reply] |
| [reply] |
Dean's Cookbook (A and B) is where I learned from. I think you have to have a use-case for why you want to learn XS first though, but given that, and given that you can find something similar in Dean's cookbook, then you're pretty much set. And even though it hasn't been updated since 1996, it's still relevant and still a really great resource.
The hard bits of XS are understanding the typemap, and figuring out how to access all the perl variable types in C (the HV's, AV's, and RV's for example), and making sure that in doing so you don't leak memory all over the floor. To learn those I just had more use-cases, and followed perlguts very carefully. | [reply] |
Let me cast another vote for Advanced Perl Programming -
not only for the coverage of XS but also the fact that it explains the differences between XS and SWIG.
-felonious-- | [reply] |