AW: Accessing variables from inside a C-XS
[email protected] ("Bolhar-Nordenkampf Ferdinand")
| Newsgroups | perl.xs |
|---|---|
| Message-ID | <D960CB61B694CF459DCFB4B0128514C205B7ABB9@exadv11.host.magwien.gv.at> |
>What you want to do would be the same like trying to access a sub's
>variable from outside the sub. This doesn't make sense, does it?
Not necessarily. Let's assume I have code like this:
my $var = 'X';
myXSfunc();
In myXSfunc(), I want to access variable $var.
Yes, I know, I could pass it as argument and access it using @_, but this would be true for any global variable as well. Therefore, this isn't the question. The question is whether there is a function like perl_get_sv(), but for lexical variables?
Or, to think one more step further, see this code:
my $x = 1;
{
my $x = 2;
{
my $x = 3;
myXSfunc();
}
}
It could be of interest for myXSfunc() to access not only the innerst-scope variable $x, but the outer-scope variables as well!
Regards, Ferry
--
Ing. Ferry Bolhár-Nordenkampf
Magistrat der Stadt Wien - MA 14
A-1010 Wien
E-mail: [email protected]