I'm running Perl 5.6.0 on SunOS 5.7 and I get the following compilation
error,
when I'm trying to embed a Perl interpreter in a C program.
gcc test.c -L/usr/local/lib
/usr/local/lib/perl5/5.6.0/sun4-solaris-thread/auto/DynaLoader/DynaLoader.a
-L/usr/local/lib/perl5/5.6.0/sun4-solaris-thread/CORE -lperl -lsocket
-lnsl -ldl -lm -lposix4 -lpthread -lc -lcrypt -lsec -D_REENTRANT
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/usr/local/lib/perl5/5.6.0/sun4-solaris-thread/CORE
test.c: In function `perl_init':
test.c:15: `thr' undeclared (first use in this function)
test.c:15: (Each undeclared identifier is reported only once
test.c:15: for each function it appears in.)
test.c: In function `PLI_call':
test.c:30: `thr' undeclared (first use in this function)
The flags I'm passing to gcc are the output of
"perl -MExtUtils::Embed -e ccopts -e ldopts".
These are the failing lines of test.c:
7 void perl_init () {
8 char *args[] = { "perl", "-e", "exit;" };
9 printf("C: Initializing Perl interpreter\n");
10
11 my_perl = perl_alloc();
12 perl_construct(my_perl);
13
14 perl_parse (my_perl, NULL, 3, args, (char **)NULL);
15 perl_eval_pv ("require 'test.pl';", TRUE);
16 }
Can anyone see what the problem is?
Many thanks,
Yannis