in reply to (tye)Re3: Answer: how do i push an array into the perl stack in C prog before calling perl_call_pv
in thread how do i push an array into the perl stack in C prog before calling perl_call_pv

hi,
sorry for my persistence.i'm kind of stuck because of this and i need to find a solution. though i am not a perl expert,i do know about basics of todays trend of languages. using reference mechanism i can do this in perl(below).Is it possible to pass this reference if i were to call this sub 'call()' from a C prog after XPUSH'ing the arguments into the perl stack. please do reply.
#begin #!/bin/perl @xyz=(abcdefghij,xyz,sdfakjsadfk); @abc=(123,345,567); &call("string1",\@xyz,\@abc,"string2"); sub call { $w=$_[0]; $x=$_[1]; $y=$_[2]; $z=$_[3]; foreach (@$x){ print "$_ "}; print "\n"; foreach ($w){ print "$_ "}; print "\n"; foreach (@$y){ print "$_ "}; print "\n"; foreach ($z){ print "$_ "}; print "\n"; } #end
thank you
ragu

Edit by tye

  • Comment on Re: (tye)Re3: Answer: how do i push an array into the perl stack in C prog before calling perl_call_pv
  • Download Code

Replies are listed 'Best First'.
(tye)Re4: Answer: how do i push an array into the perl stack in C prog before calling perl_call_pv
by tye (Sage) on May 09, 2001 at 11:10 UTC

    Which takes us back to what I said first: You can make a reference to the array and XPUSH that. See "perldoc perlguts" under the heading "References" for more information.

    Sorry, I don't know how to make a reference off the top of my head, but I doubt that it is terribly difficult.

            - tye (but my friends call me "Tye")
      got it .thanks a lot. ragu