You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Archana Narla <ar...@moonlight.com> on 2002/02/01 21:44:38 UTC

Accessing a list of returned values from perl in C code

HI,
    I have  a perl subroutine that is like
sub test {
    return ( 12, 34);
}

In my C++ code I'm doing this ...

routine1 () {
dSP;
ENTER;
SAVETMPS;
PUSHMARK(sp);
  XPUSHs(sv_2mortal(newSVpv(jStrChars, 0)));
PUTBACK;
n = perl_call_pv("genericInvoke", G_SCALAR);
   SPAGAIN;
  SV* sv2 = POPs;
   SV* sv1 = POPs;

}

------
When I test for sv1, it is not a scalar value??!! sv2 is just fine. 
returns the right value.

what am i missing?

thanks
Archana


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Accessing a list of returned values from perl in C code

Posted by Archana Narla <ar...@moonlight.com>.
OopS! Sorry..about the list.
Thanks, that worked!

archana

Gerald Richter wrote:

>>your missing the proper mailing list,
>>
> 
> Yes
> 
> anyway...
> 
> 
>>>n = perl_call_pv("genericInvoke", G_SCALAR);
>>>
> 
> You have to call it in array context, so write:
> 
>  n = perl_call_pv("genericInvoke", G_ARRAY);
> 
> Gerald
> 
> 
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
> 
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------
> 
> 


-- 
Archana Narla
Senior Software Engineer
Moonlight Systems ) ) | ( (
415.869.0246 (Ph)
415.278.0894 (Fax)


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Accessing a list of returned values from perl in C code

Posted by Gerald Richter <ri...@ecos.de>.
> your missing the proper mailing list,

Yes

anyway...

> > n = perl_call_pv("genericInvoke", G_SCALAR);

You have to call it in array context, so write:

 n = perl_call_pv("genericInvoke", G_ARRAY);

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Accessing a list of returned values from perl in C code

Posted by ___cliff rayman___ <cl...@genwax.com>.
your missing the proper mailing list,
unless i am missing something.   ;-)

embperl is all about serving up html pages
with embedded perl code.

try:
comp.lang.perl.moderated
comp.lang.perl.misc

Archana Narla wrote:

> HI,
>     I have  a perl subroutine that is like
> sub test {
>     return ( 12, 34);
> }
>
> In my C++ code I'm doing this ...
>
> routine1 () {
> dSP;
> ENTER;
> SAVETMPS;
> PUSHMARK(sp);
>   XPUSHs(sv_2mortal(newSVpv(jStrChars, 0)));
> PUTBACK;
> n = perl_call_pv("genericInvoke", G_SCALAR);
>    SPAGAIN;
>   SV* sv2 = POPs;
>    SV* sv1 = POPs;
>
> }
>
> ------
> When I test for sv1, it is not a scalar value??!! sv2 is just fine.
> returns the right value.
>
> what am i missing?
>

--
___cliff rayman___cliff@genwax.com___http://www.genwax.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org