add docs about the new directive forms %ref/%unref for the old ref/unref features
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8554 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c09e55e409
commit
0fbffb15df
1 changed files with 23 additions and 3 deletions
|
|
@ -1997,7 +1997,8 @@ Object 'RCObj', which implements the ref/unref idiom.
|
|||
|
||||
<p>
|
||||
To tell SWIG that 'RCObj' and all its derived classes are reference
|
||||
counted objects, you use the "ref" and "unref" features. For example:
|
||||
counted objects, you use the "ref" and "unref" features, or
|
||||
<tt>%ref</tt> and <tt>%unref</tt> directives (since 1.3.28). For example:
|
||||
</p>
|
||||
|
||||
|
||||
|
|
@ -2015,8 +2016,27 @@ counted objects, you use the "ref" and "unref" features. For example:
|
|||
</pre>
|
||||
</div>
|
||||
|
||||
or, using the directive form:
|
||||
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
%module example
|
||||
...
|
||||
|
||||
%ref RCObj "$this->ref();"
|
||||
%unref RCObj "$this->unref();"
|
||||
|
||||
%include "rcobj.h"
|
||||
%include "A.h"
|
||||
...
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
where the code passed to the "ref" and "unref" methods will be
|
||||
where the code passed to the "ref" and "unref" features will be
|
||||
executed as needed whenever a new object is passed to python, or when
|
||||
python tries to release the shadow object instance, respectively.
|
||||
</p>
|
||||
|
|
@ -2058,7 +2078,7 @@ them as:
|
|||
<p>
|
||||
In other words, SWIG will not do anything special when a new object
|
||||
is passed to python, and it will always 'delete' the object when
|
||||
python releases the shadow instance.
|
||||
python releases the proxy instance.
|
||||
</p>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue