what does the last argument to SWIG_NewPointerObj mean?

断了今生、忘了曾经 提交于 2019-12-04 00:05:38

When you create new pointer objects with SWIG_NewPointerObj, you may pass the following flags:

SWIG_POINTER_OWN
SWIG_POINTER_NOSHADOW

If SWIG_POINTER_OWN is set, the destructor of the underlying C++ class will be called when the Python pointer is finalized. By default, the destructor will not be called. See Memory Management

For your use case, you don't need to set any flags at all.

From what I can see in the sources, if SWIG_POINTER_NOSHADOW is set, then a basic wrapped pointer is returned. You will not be able to access member variables in Python. All you'll have is an opaque pointer.

Reference: /usr/share/swig/2.0.7/python/pyrun.swg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!