Dan Muey wrote:

[snip]

> 
> perlemb.c:18: macro `SvPV' used with just one arg
> 
> So I tried it as
> printf("%s", SvPV(eval_pv(perlcode),n_a));
> Which is how it was in another example and got:

you don't need to supply n_a if you are not intested in the length of the 
SV, Perl has another api for that: SvPV_nolen. i am not sure how you can 
compile eval_pv without the error flag, i would write the above as:

printf("%s",SvPV_nolen(eval_pv(perlcode,0)));

> 
> perlemb.c: In function `main':
> perlemb.c:18: invalid type argument of `->'
> perlemb.c:18: invalid type argument of `->'
> perlemb.c:18: invalid type argument of `->'
> perlemb.c:18: warning: passing arg 1 of `Perl_sv_2pv' makes pointer from
> integer without a cast

which line is 18? what version of xssubpp are you using? the following 
should tell you that:

[panda]# perl ${PATH}/xsubpp -v

finally, i am VERY surprise that your code:

>const char *perlcode = "use CGI 'header';print header();print 'hello 
World';";

will work at all. the reason being is that the Perl interpreter you create 
with:

> static PerlInterpreter *my_perl;

does NOT support dynamic loading. if the module that you are trying to use 
is written entirely in Perl, it usually works but 'CGI' is not written 
purely in Perl. any module that uses XS/C must be loaded up during start up 
and the Perl interpreter you created does not support that. even if you can 
compile your script, you will get a nasty error when you actually try to 
run it. the error (depends on what version of xsubpp you are using) usually 
tells you that CGI.pm can not found. the solution is to link a special file 
after you create your interpreter. Embed.pm has a function for creating 
this file:

[panda]# perl -MExtUtils::Embed -e xsinit

this will create a file perlxsi.c in the current directory. once you have 
that, you need to link it against your object file and change:

> perl_parse(my_perl, NULL, argc, argv, (char **)NULL);

to:

perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);

i omit a LOT of details but it's almost impossible to tell you everything 
you need to know to successfully embed Perl in C with a single message.

david
-- 
s,.*,<<,e,y,\n,,d,y,.s,10,,s
.ss.s.s...s.s....ss.....s.ss
s.sssss.sssss...s...s..s....
...s.ss..s.sss..ss.s....ss.s
s.sssss.s.ssss..ss.s....ss.s
..s..sss.sssss.ss.sss..ssss.
..sss....s.s....ss.s....ss.s

,....{4},"|?{*=}_'y!'+0!$&;"
,ge,y,!#:$_(-*[./<[EMAIL PROTECTED],b-t,
.y...,$~=q~=?,;^_#+?{~,,$~=~
y.!-&*-/:[EMAIL PROTECTED] ().;s,;,
);,g,s,s,$~s,g,y,y,%,,g,eval

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to