[Israel.pm] Calling perl from C

Boaz Goldstein boaz.gezer at gmail.com
Mon Oct 11 10:06:59 PDT 2004

On Mon, 11 Oct 2004 18:13:23 +0200, Yuval Marsiano
<yuval.marsiano at starcore-dsp.com> wrote:
> Hi,
> Could someone tell me what is the best way call from C, a perl subroutine, which is returning to the C module array of strings?
> Thanks
>         Yuval

the simple way:
to call use eval_pv()
have the perl subroutene store a refrence to the list in the global
variable $foo
to get the refrence use SV *bar=get_sv("main::foo",false);
use AV your_array = (AV *)SvRV(bar); 
you now have your array of strings in your_array
you will need the perl api functions to handle it,
and it is still in perl memory so your changes will afect perl variables


More information about the Perl mailing list