Greg <[EMAIL PROTECTED]> writes:
>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?
If it works in C, but fails on C++ then chances are the problem is
not in the code but in the compile/link flags and libraries.
(There is an outside chance that we are missing an extern "C" or
some cast abstraction, but if it works with "same" compiler (g++)
somewhere then that is unlikely.)
Can you show those "build" command lines for linux/390 for C and C++?
Does g++ build report any warnings?
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/