Hi,
I'm trying to access Perl (subroutine) from C++ -program and seems that perlembed would be a good choise for that. I just would simply need to ivoke Perl, run script/call sub and then clean-up and continue in C++ program.
I've tried to run examples from e.g:
but unfortunately with no luck (read many articles and done browsing, but didn't yet got it working). I'm running ActivePerl 5.8.7 on WindowsXP with MinGW/Msys and GCC 3.4.2. I constantly get the following kind of errors: "undefined reference to perl_alloc" (for all calls, with perl_*).
I have Perl installed to D:\Perl and the source test.cpp is located in the same directory. I used the following to compile:
gcc -DWIN32 -I/d/Perl/lib/CORE -L/d/Perl/lib/CORE -o test test.cpp
I was wondering if you would have good tips or tricks for embedding Perl into C++.
Thanks in advance!
I'm trying to access Perl (subroutine) from C++ -program and seems that perlembed would be a good choise for that. I just would simply need to ivoke Perl, run script/call sub and then clean-up and continue in C++ program.
I've tried to run examples from e.g:
Code:
#include <EXTERN.h> /* from the Perl distribution */
#include <perl.h> /* from the Perl distribution */
static PerlInterpreter *my_perl; /*** The Perl interpreter ***/
int main(int argc, char **argv, char **env)
{
my_perl = perl_alloc();
perl_construct(my_perl);
PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
perl_run(my_perl);
perl_destruct(my_perl);
perl_free(my_perl);
}
but unfortunately with no luck (read many articles and done browsing, but didn't yet got it working). I'm running ActivePerl 5.8.7 on WindowsXP with MinGW/Msys and GCC 3.4.2. I constantly get the following kind of errors: "undefined reference to perl_alloc" (for all calls, with perl_*).
I have Perl installed to D:\Perl and the source test.cpp is located in the same directory. I used the following to compile:
gcc -DWIN32 -I/d/Perl/lib/CORE -L/d/Perl/lib/CORE -o test test.cpp
I was wondering if you would have good tips or tricks for embedding Perl into C++.
Thanks in advance!