I can't figure out how, or if it is possible, to access my'd variables from 
inside a C function.  

I want to do something like:
====
my $VAR = "abc";
sub func {      
        print "$VAR\n";
}
func();
====

But my stab at the perl api does not seem to do it:
====
my $VAR = "abc";

use Inline C => <<EOF;
void func() {
    SV * VAR = get_sv( "VAR", FALSE );
    if( VAR ) {
        printf("VAR = %s\n", (char*)SvPV(VAR,PL_na));
    } else {
        printf("VAR is NULL\n");
    }
}
EOF

func();
====

Any suggestions?

Thanks!
-Cory

Reply via email to