hermida has asked for the wisdom of the Perl Monks concerning the following question:

Just want to ask people with experience binding C++ to Perl what they think as to the differences, advantages, disadvantages and when one should use the following toolkits: Also, are there any others? I read someone mentioning libperl++, don't know much about it maybe there are other good ones?

Replies are listed 'Best First'.
Re: Comparing C++ Perl Binding Toolkits
by educated_foo (Vicar) on Mar 08, 2011 at 00:26 UTC
    IMHO SWIG is the way to go: it's quite sophisticated in handling inheritance, templates and the STL, and it's actively maintained. And if you upload the generated C++ files to CPAN, your users don't even have to have it installed.

      Hi thank you very much for the advice, one question, will SWIG pretty much auto-generate all the XS and related files for you from the C/C++ files?

      Also, why does anyone use XS or XS++ when you have something like SWIG? XS is very painful... :(

        SWIG generates a C/C++ wrapper. It can do so directly from the header files, but you're often better off writing your own interface file (in a language similar to C/C++, but cleaner than XS). As for why people use XS, it comes with Perl, while SWIG is yet another complex dependency.