ibm1620 has asked for the wisdom of the Perl Monks concerning the following question:
Our company obtained a C++ source code license for Metaphone3 and I want to test it using Perl as a driver. I'm wondering what my options are. In the past, when I needed to call a complex C subroutine from Perl, I've written a standalone C++ program that accepted command-line parameters, called the subroutine, and wrote the output to STDOUT, and then "called" it using qx//. That's certainly still a possibility, but on the offchance that the forking and IPC would pose a performance hit (I'm going to test 100M's of strings), I wondered if XS was a practical possibility.
I have never written an XS module, and it looks daunting, but I thought there might be some XS stub code out there that I could easily tweak so that a Perl program could call one subroutine, passing in one string and getting two strings back; end of story.
Any thoughts on the subject? Other approaches?
(Metaphone3 is also available in Perl, but unfortunately that's a separate license.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Calling a C++ subroutine from Perl
by tobyink (Canon) on Mar 19, 2019 at 01:02 UTC | |
by syphilis (Archbishop) on Mar 19, 2019 at 11:44 UTC | |
by ibm1620 (Hermit) on Mar 19, 2019 at 15:10 UTC | |
|
Re: Calling a C++ subroutine from Perl
by swl (Prior) on Mar 19, 2019 at 02:29 UTC | |
by ibm1620 (Hermit) on Mar 19, 2019 at 15:19 UTC | |
|
Re: Calling a C++ subroutine from Perl
by markong (Pilgrim) on Mar 19, 2019 at 16:59 UTC | |
|
Re: Calling a C++ subroutine from Perl
by bliako (Abbot) on Mar 19, 2019 at 18:26 UTC | |
|
Re: Calling a C++ subroutine from Perl
by misc (Friar) on Mar 20, 2019 at 08:54 UTC | |
by ibm1620 (Hermit) on Mar 20, 2019 at 17:12 UTC |