I have a slightly modified version of the example in perlembed.
compiling with gcc works on both Linux/Intel and Linux/390. compiling
with g++ works on Linux/Intel but segfaults on Linux/390.
the code:
#define PERL_NO_GET_CONTEXT
#include <EXTERN.h> /* from the Perl distribution */
#include <perl.h> /* from the Perl distribution */
#include <stdio.h>
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);
if (SvTRUE(ERRSV)) {
printf("SvTRUE(ERRSV) is true\n");
} else {
printf("SvTRUE(ERRSV) is false\n");
}
perl_destruct(my_perl);
perl_free(my_perl);
}
the behaviour on linux/390 when compiled with g++:
$./interp -e'print "Hello World\n";'
Hello World
Segmentation fault
$
The seg fault is on the
if (SvTRUE(ERRSV)) {
line.
Can anyone see what I'm doing wrong / whats happening?
Thanks,
Greg