Fix shared_ptr typemaps for use with %pythonnondynamic
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10344 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a37115f55d
commit
69d6ce4f33
5 changed files with 48 additions and 1 deletions
|
|
@ -178,6 +178,7 @@ CPP_TEST_CASES += \
|
|||
langobj \
|
||||
li_attribute \
|
||||
li_boost_shared_ptr \
|
||||
li_boost_shared_ptr_bits \
|
||||
li_carrays \
|
||||
li_cdata \
|
||||
li_cpointer \
|
||||
|
|
|
|||
18
Examples/test-suite/li_boost_shared_ptr_bits.i
Normal file
18
Examples/test-suite/li_boost_shared_ptr_bits.i
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
%module li_boost_shared_ptr_bits
|
||||
|
||||
%include <boost_shared_ptr.i>
|
||||
|
||||
#if defined(SWIGPYTHON)
|
||||
%pythonnondynamic NonDynamic;
|
||||
#endif
|
||||
|
||||
SWIG_SHARED_PTR(NonDynamic, NonDynamic)
|
||||
|
||||
%inline %{
|
||||
#include <boost/shared_ptr.hpp>
|
||||
struct NonDynamic {
|
||||
int i;
|
||||
};
|
||||
boost::shared_ptr<NonDynamic> boing(boost::shared_ptr<NonDynamic> b) { return b; }
|
||||
%}
|
||||
|
||||
20
Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py
Normal file
20
Examples/test-suite/python/li_boost_shared_ptr_bits_runme.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from li_boost_shared_ptr_bits import *
|
||||
|
||||
def check(nd):
|
||||
nd.i = 200
|
||||
i = nd.i
|
||||
|
||||
try:
|
||||
nd.notexist = 100
|
||||
passed = 0
|
||||
except:
|
||||
passed = 1
|
||||
|
||||
if not passed:
|
||||
raise "Test failed"
|
||||
|
||||
nd = NonDynamic()
|
||||
check(nd)
|
||||
b = boing(nd)
|
||||
check(b)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue