New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
caller_cx(0,NULL) returns NULL #15903
Comments
From @hakonhaglandI am trying to figure out the package name of the caller from an XSUB. p.pl: #! /usr/bin/env perl lib/My/Caller.pm: package My::Caller; our @ISA = qw(Exporter); XSLoader::load(); sub test2 { print "My::Caller::test2() : $package_name\n"; lib/My/Caller.xs: #include "EXTERN.h" void test() { MODULE = My::Caller PACKAGE = My::Caller void Output from running p.pl: My::Caller::test() : NULL Expected output: My::Caller::test() : main Running Perl version 5.24.1 on Ubuntu 16.10. The whole test case can be downloaded form here: https://github.com/hakonhagland/caller_cx_bug See also: Best regards, |
From @iabynOn Thu, Mar 02, 2017 at 12:14:27PM -0800, Håkon Hægland wrote:
From the docs for caller_cx(): Note that XSUBs don't get a stack frame, so C<caller_cx(0, NULL)> will Since you are calling the XS function 'test' directly from the main sub f { My::Caller::test() } gives My::Caller::test() : Bar -- |
The RT System itself - Status changed from 'new' to 'open' |
From @hakonhaglandThanks Dave Mitchell! Wrapping the XSUB call in a Perl subroutine works 2017-03-06 13:01 GMT+01:00 Dave Mitchell via RT <perlbug-followup@perl.org>:
|
From @KES777I think perl today should provide some thing like current context (and such structure already exists in the CORE) And when sub is called perl just: push @stack, \@current_context; Today we should group all those things together ( Does API exists already? http://stackoverflow.com/questions/42629915/is-there-a-way-to-access-special-tokens-in-perl-from-xs ) |
@iabyn - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#130903 (status was 'rejected')
Searchable as RT130903$
The text was updated successfully, but these errors were encountered: