There are no speed or granularity differences between the three methods--ultimately they generate about equvalent C code. Pick whatever's most comfortable, though SWIG is the least common for perl modules, and XS has the advantage of being installable with just the base perl, not needing any other modules.

Where you run into the interesting parts is when you deal with perl's API, and that's the same no matter which scheme you use. The only thing that Inline and SWIG do differently is how they wrap the function parameters and return values. Inline has a few interesting ways to dynamically generate the function body itself, but for static functions there's no real difference.

Writing extension code in C is really no big deal. People seem terrified about it, but that's just stupid. It's only C after all--it's a computer language. It's not going to eat you or lurk under your bed waiting to steal your soul or anything. (Not like you're programming in lisp here)

You may ultimately not like C. That's fine. And you may end up cursing the state of the API and all its half-documented quirks. That's fine too.

Just don't be afraid of it. It's only ones and zeroes after all...


In reply to Re: Inline::C vs. XS vs. SWIG by Elian
in thread Inline::C vs. XS vs. SWIG by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.