Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I have used all three.

Inline::C will immediately work for simple things, and you'll be very gratified and encouraged -- enough so that you'll quickly expand to use it for all kinds of things and wrap your whole UI. Then you'll run into some small problem. Probably something to do with reference counts. You've made it so far already, it can't be that hard to just fix up the one little problem... soon you'll be learning large portions of XS, in a completely ass-backwards order, and just before you realize that you've completely lost track of what led you down that hellish path, you'll go insane.

XS will require a big investment of time and documentation-reading up front, which will do you no good whatsoever, since everything you try will break for bizarre and subtle reasons. You'll think you understand it, and get more and more confident as you read the documentation and feel everything falling neatly into place. Until you actually try to use it, when nothing will seem to work at all like what you read, even though you can't find anything that directly contradicts what you read. Looking at the generated C code will make you even more confused.

At some point, you'll realize that the only way to make any headway is to copy an existing XS interface and mutate it into what you want. This will mostly work, and you'll gradually make progress. Gradually but not steadily -- you will frequently encounter major roadblocks that will leave smatters of blood and brain pulp on the nearest brick wall. It's a bit like crossing a freeway with a chihuahua chewing on your ankle, getting flattened by several cars and an SUV on the way across. Still, everything you learn will be useful; you'll just have to gradually build up your knowledge in stages.

SWIG is bliss. It effortlessly wraps everything you want (and far more, since it traces through a bunch of headers you didn't really intend). It presents the API to you in nice clean Perl.

But it's slow. And 20% of the time, it doesn't work at all. Another 20% of the time, it almost works but does something blindingly idiotic. And when it doesn't work, it'll be like dissecting a frog in high school science class to figure out what's going wrong. You know -- those special high school science class frogs, that have groxbitner where the textbook says they should have lungs, sporkinits instead of intestines, and a blob of yerfikation in place of a heart. In other words, there are layers and layers of nonsensical internals specifically designed to make your brain dribble out your ears.

All clear now?


In reply to Re: $perl_extension ? require SWIG : require XS; by sfink
in thread $perl_extension ? require SWIG : require XS; by shonorio

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (9)
    As of 2014-12-26 12:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (171 votes), past polls