On Oct-26, Leopold Toetsch wrote:
> Steve Fink <[EMAIL PROTECTED]> wrote:
> > I am getting a seg fault when doing a very simple subroutine call with
> > IMCC:
> 
> >     .sub _main
> >             newsub $P4, .Sub, _two_of
> >             $P6 = new PerlHash
> >             .pcc_begin prototyped
>                          ^^^^^^^^^^
> >     .pcc_sub _two_of non_prototyped
>                        ^^^^^^^^^^^^^^
> 
> You are stating explicitely conflicting call types. That can't work.
> When you remove "non_prototyped" in the sub, its prepared to be called
> either way and it works.

That is working for me now for the parameter passing, but not for
return values. The below code seg faults because it is attempting to
pry return values out of P3; it works if I switch the line
  .pcc_begin non_prototyped
to
  .pcc_begin prototyped

I'm not sure if this is implemented yet, though.

Code follows:

  .sub __main
          .local Sub main_sub
          main_sub = newsub _main
          .pcc_begin non_prototyped
          .pcc_call main_sub
  ret:
          .result $I0
          .result $I1
          .pcc_end
          print "Returned "
          print $I0
          print ","
          print $I1
          print "\n"
          end
  .end

  .pcc_sub _main prototyped
          .pcc_begin_return
          .return 10
          .return 20
          .pcc_end_return
  .end

Reply via email to