News for hackers. Stuff that matters.
Re:Shoestring Budget? Starting to feel growth issues on you... by kingkongrevenge on Tuesday September 09, 2008 @01:37PM (#299629)
Python has no advantage in this regard over any other language supported by SWIG. And perl almost certainly has more available library bindings than python.
Re:Shoestring Budget? Starting to feel growth issues on you... by inklesspen on Tuesday September 09, 2008 @04:38PM (#299821)
Someone hasn't heard of ctypes: http://docs.python.org/lib/module-ctypes.html

It lets you use arbitrary c libraries in Python. It automatically does the wrapping for you.

Re:Shoestring Budget? Starting to feel growth issues on you... by kingkongrevenge on Tuesday September 09, 2008 @05:40PM (#299861)
I hadn't heard of ctypes, but the same functionality is available in perl. It seems pretty silly and crash prone to me to dynamically load object code and then wrap it with a load of error checking rather than write proper bindings.
Re:Shoestring Budget? Starting to feel growth issues on you... by llimllib on Tuesday September 09, 2008 @01:53PM (#299647)
ctypes, cython, Boost::python and pyrex are real advantages in this regard; SWIG is extremely painful in comparison.
Re:Shoestring Budget? Starting to feel growth issues on you... by SwellJoe on Tuesday September 09, 2008 @02:33PM (#299688)
Both Perl and Python have far nicer ways to link to C than SWIG. Having worked with both, I think they're about equal these days on the binding to C front (though, as always, in Perl there's far more than one way to do it, and there's only a couple of obvious ways to do it in Python).
Re:Shoestring Budget? Starting to feel growth issues on you... by kingkongrevenge on Tuesday September 09, 2008 @02:39PM (#299697)
Do you know of any perl & C++ solutions other than perlxs and swig?
Re:Shoestring Budget? Starting to feel growth issues on you... by SwellJoe on Tuesday September 09, 2008 @03:17PM (#299739)
I've never used C++ from Perl, only C, but there is a version of Inline for C++ here: http://search.cpan.org/~neilw/Inline-CPP-0.25/

The nice thing about Inline is that the bindings are obviously named (function foo() in C becomes sub foo in Perl), and it's all automagic. Of course, if your C/C++ code is big or an existing library you want to bind to rather than just a few bits and pieces, perlxs (and its related utilities) might very well still be the way to go. There is XSpp, which supposedly makes C++ and XS play nicer together. But perlxs is dramatically better than SWIG in most circumstances I can think of (I don't mean to imply that SWIG is not a wonderful tool--it's a fantastic tool, but both Perl and Python have language-specific solutions to most of the same problems that are superior).

But you can't beat Inline::C (and I guess Inline::CPP) for simplicity. If you know both Perl and C/C++ their usage is absolutely obvious. perlxs requires a little more reading, and I have to consult the docs whenever I cross paths with it. Python has Weave (part of SciPy), if you like the inline model, though I'm not sure it's being maintained heavily these days.

If large data sets are your problem (some of the things you might use the numeric data structure tools in Boost for), PDL might be a solution, since it has a lot of tools for manipulating large data sets without having to revert to writing your own C. Likewise NumPy in Python. And, of course, there are already Perl bindings for Boost in CPAN, though the vast majority of Boost seems to be just making C++ more like Perl, rather than adding anything that Perl coders would find interesting.

Re:Shoestring Budget? Starting to feel growth issues on you... by ivankirigin on Tuesday September 09, 2008 @01:49PM (#299642)
But python is a pleasure to code. Also, I prefer Boost, and know the python bindings are solid.