William Ahern <[EMAIL PROTECTED]> writes: >Is it not possible to directly call built-in functions like caller?
It is _possible_ to call perl ops from XS but is far from easy - I have never bothered to finish working out all the hoops you have to jump through. You can "of course" do what caller() does in your C code - but that isn't pretty either. >The only >way I could call caller was to wrap it in a subroutine, in this case an >anonymous sub routine: sub { caller shift }. That is what I did too. > >Everytime I tried to call it directly (with every option under the sun) Perl >would somehow longjmp over my XS code back into the initial call into Perl. >The flow looked like C -> Perl:perl_parse() -> C:XS -> Perl:call_pv("caller"). >call_pv would jump back to per_parse, across the XS code. Very strange. caller isn't a sub it is an opcode. You are doing equivalent of &{"caller"}(). So perl is essentially die-ing which is why it longjmp()s. If you had call_pv("caller",G_EVAL) you could have caught the message. > >Things seem to be working, but I'm curious what the real issue was. > >TIA, > >Bill