Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 XS 中,如何将包含变量名称的字符串转换为其地址,我想做类似以下 perl 代码的操作:
our $var = 1; print ${$main::{var}};
在perlguts中,它说:
如果您知道标量变量的名称,则可以使用以下命令获取指向其 SV 的指针: SV* get_sv("package::varname", FALSE);
如果您知道标量变量的名称,则可以使用以下命令获取指向其 SV 的指针:
SV* get_sv("package::varname", FALSE);