You might also look at: Perl and C++ and Extending Perl (Using C from Perl). (Quote from the page:) If you want to use C source code (or a C library) from Perl, you need to create a library that can be either dynamically loaded or statically linked into your perl executable. (Dynamic loading is usually preferred, to minimize the number of different perl executables sitting around being different.) You create that library by creating an XS file (ending in .xs) containing a series of wrapper subroutines. The wrapper subroutines are not Perl subroutines, however; they are in the XS language, and we call such a subroutine an XSUB, for "eXternal SUBroutine". An XSUB can wrap a C function from an external library, a C function elsewhere in the XS file, or naked C code in the XSUB itself. You then use the xsubpp utility bundled with Perl to take the XS file and translate it into C code that can be compiled into a library that Perl will understand.
| [reply] |
| [reply] |
SWIG and XS are both usable ways of adding C++ libraries to Perl. It's also a great way to combine the flexibility of the Perl interpreter with compiled code for commercial applications.
Check out CH. 20 of Advanced Perl Programming (O'Reilly, S. Srinivasan), the "Panther Book".
Caveat: it takes a while to set up either of these environments, but integration is swift once you have done so. Each has its advantages and disadvantages. SWIG is simpler, but XS is much used for .pm's so it might be worth your time to study. C2: These are 'nix-based solutions, YMMV on Doze. | [reply] |
| [reply] |
Also, take a look at Win32::API. It's kinda rough around the edges, but it works fine.
| [reply] |