develooper Front page | perl.inline | Postings from November 2016

Question about accessing global data from a line function

Thread Next
From:
Perf Tech
Date:
November 24, 2016 07:19
Subject:
Question about accessing global data from a line function
Message ID:
CAL27a14Y_nfkJERuqnuBVE=WObwMMqsBuqjWUquNdZ4s0EXXhA@mail.gmail.com
Dear expert,

   I am trying to access perl global variable ($data in this case) from
within a inline C function, but the "data" variable I used is not defined.
Any idea how to do it?

Thanks
Jin


$data = "this is a test";
test();

use Inline C => <<'END_OF_C_CODE';

void test() {
printf("here: %s\n", SvPV(data, PL_na));
}

END_OF_C_CODE

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About