semuel has asked for the wisdom of the Perl Monks concerning the following question:
I am writing a program in C that embeds Perl. one of my functions does this:
The problem is, if I uncomment the last line, I get en error saying the I try to decresed a ref_count of zero.void my_load_module(pTHX_ const char *module_name) { SV *sv_name = newSVpv(module_name, 0); load_module(PERL_LOADMOD_NOIMPORT, sv_name, Nullsv); // SvREFCNT_dec(sv_name); }
why?Attempt to free unreferenced scalar: SV 0x0....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perlembed: reference counts
by Joost (Canon) on Sep 19, 2007 at 22:08 UTC | |
by semuel (Novice) on Sep 20, 2007 at 19:09 UTC | |
by Joost (Canon) on Sep 20, 2007 at 19:13 UTC | |
by tye (Sage) on Sep 20, 2007 at 19:56 UTC |