in reply to Re: C++ object & PERL garbage collection
in thread C++ object & PERL garbage collection


i have a perl HASH which is a SWIG wrapper of a C++ object.

if i new the object, and pass the reference around
it sometimes works and sometimes fails.
if NEW is in MAIN and passed "down", it works if NEW is in ROUTINE and passed "up", it fails

and hopefully my usage of up/down is clear!
using namespaces :
if new'd as MAIN::object, -> works in all "lower" routines if new'd as MAIN::routineA::object -> does NOT work in MAIN

you have a interesting point about newSVsv. it looks like i want something like that.
i need a mechanism for PERL to never delete an object
but i wanted to avoid using a GLOBAL variable that is OUR
maybe that is the purpose of OUR?

Replies are listed 'Best First'.
Re^3: C++ object & PERL garbage collection
by creamygoodness (Curate) on Sep 24, 2006 at 00:18 UTC

    I have to say, I'm very confused by your capitalization. Perl is case-sensitive. There is no OUR, there is only our. Similarly, when you refer to MAIN, I don't know whether you're referring to the default main namespace in Perl, or something having to do with C++ or SWIG.

    I can understand your English despite the miscapitalization of words like "I". However, your Perl/C++ leaves me baffled. Can you please reformulate this message to use proper capitalization and punctuation in both the English and the code?

    --
    Marvin Humphrey
    Rectangular Research ― http://www.rectangular.com