in reply to Re: Inline::C callbacks to Perl
in thread Inline::C callbacks to Perl
I agree with what [id://liverpole] is saying.
What is happening is that the SV that is holding the reference gets destroyed. Storing it in a variable leads to the same problem. (When the variable goes out of scope that is).
The proper way to prevent this from happening is to increase the reference counter of the code-SV. (Since that will prevent the reference counter of the (temp) variable to become 0. Meaning Perl won't destroy it.)
(You can do this by using SvREFCNT_inc(code);. You can read more about the function/macro in perlapi)
Update: changed wording
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Inline::C callbacks to Perl
by BrowserUk (Patriarch) on Nov 11, 2005 at 22:52 UTC |