# The following was supposedly scribed by
# Sisyphus
# on Monday 13 September 2004 10:47 pm:

>void call_me_stupid(int a, int b) {
>      Inline_Stack_Vars;
>      Inline_Stack_Reset;
>      Inline_Stack_Push(sv_2mortal(newSViv(a)));
>      Inline_Stack_Push(sv_2mortal(newSViv(b)));
>      Inline_Stack_Done;
>      perl_call_pv("main::me_stupid", G_DISCARD);
>      Inline_Stack_Void;
>}

void call_me_stupid(int a, int b) {
      perl_call_pv("main::me_stupid", G_DISCARD);
}

That works for me running 5.8.4 on Linux (even without the loop.)  As 
far as I can tell, the stack is involved with the for(1..4) block's 
implied $_ variable?  No, wait that can't be it.  This still gives 
the same "1 4" result:

use warnings;
use Inline C => <<'EOC';

void call_me_stupid(int a, int b) {
      Inline_Stack_Vars;
      Inline_Stack_Reset;
      Inline_Stack_Push(sv_2mortal(newSViv(a)));
      Inline_Stack_Push(sv_2mortal(newSViv(b)));
      Inline_Stack_Done;
      perl_call_pv("main::me_stupid", G_DISCARD);
      Inline_Stack_Void;
}

EOC

foreach my $i (3..4) {
print "$i: ";
call_me_stupid(3,5);
}

sub me_stupid {
     print "$_[0] $_[1]\n";
     }

__END__

--Eric
-- 
"It works better if you plug it in!" 
                                        --Sattinger's Law

Reply via email to