I will mention the possibility to embed a perl interpreter inside a C program. See perlembed. It has benefits if your main logic is in C/C++ and you just want a quick regex engine or accessing a database). For example: in perl embeded engine access database, retrieve data, filter data, use regex and other easy-peasy perl string mamipulations, then pass result back to C for metaphone. That gives you additional freedom depending where your main program logic is.

There is a bigger prize though: parallelism. Theoretically you can have many perl interpreters in same C program. And you may find the C++ threads model, option of shared memory etc., is better suited for your needs than Perl's.

I have not tried compiling a C++ program with perl embeded, only with C. The reason I am mentioning it is that it gives you one more way to experiment. I can give more details if you want to proceed. I must say that you may encounter a few hiccups in compiling and linking with perl's headers and library. But the major difficulty will be that the same compiler used in compiling your perl must also be used in compiling the perl-embedded C/C++ program. That means C++. Which theoretically should be OK but in practice it may complain about c++XYZ standard of the month forbidding this or that.

bw, bliako


In reply to Re: Calling a C++ subroutine from Perl by bliako
in thread Calling a C++ subroutine from Perl by ibm1620

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.