List:NDB Connectors« Previous MessageNext Message »
From:Mika Raento Date:May 8 2007 7:21am
Subject:Re: [Fwd: Re: [Swig-user] C++ wrapping question]
View as plain text  
Monty Taylor wrote:
> Mika Raento wrote:
>> Monty Taylor wrote:
>>> Here's some info about refcounting... it looks like we need to explore
>>> %refcount and %unrefcount
>> Hm. I don't think it's that simple. The %refcount stuff assumes your C++
>> objects are refcounted. Which the Ndb objects aren't. Which is why I've
>> been toying with the idea of hooking into the reference counting/gc of
>> the target languages. But that may not be possible in any realistic way.
> 
> Indeed, you are right.
> 
> There are only a few things that need to get refcounted - Ndb,
> NdbTransaction, NdbOperation... and even then it's unlikely that you let
> the Ndb go out of scope. So maybe hooking in language level refcounting
> wouldn't be too terrible.
> 

I'm looking into the target-language option. Basically what is needed to
do that is to:

1. in each target language, have a place to stash the extra reference
(e.g., a module level hash in perl)
2. shadow startTransaction/asynchPrepare to stash an extra reference to
Ndb/Ndb+transaction (NdbOperations are owned by the transaction)
3. shadow close/callback to remove the extra reference

Out of these 3. is the only one I'm not sure how to do. I have to find
out whether you can shadow the destructor. Shadowing the callback will
already give a place to keep the extra reference: create another closure
around the callback given by the user-level program that maintains a
reference.

It's just a pain that we (well, you, I only care about perl for the
moment :-) have to do it for each target language separately.

     Mika

Thread
[Fwd: Re: [Swig-user] C++ wrapping question]Monty Taylor7 May
  • Re: [Fwd: Re: [Swig-user] C++ wrapping question]Mika Raento8 May
    • Re: [Fwd: Re: [Swig-user] C++ wrapping question]Monty Taylor8 May
      • Re: [Fwd: Re: [Swig-user] C++ wrapping question]Mika Raento8 May
        • Re: [Fwd: Re: [Swig-user] C++ wrapping question]Monty Taylor8 May
          • Re: [Fwd: Re: [Swig-user] C++ wrapping question]Mika Raento8 May
            • Re: [Fwd: Re: [Swig-user] C++ wrapping question]Mika Raento8 May
              • Re: [Fwd: Re: [Swig-user] C++ wrapping question]Mika Raento8 May
          • compilation fails from bzrMika Raento8 May
            • Re: compilation fails from bzrMonty Taylor8 May