example of how to include the swig runtime code into external user code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6753 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0baa17ec05
commit
eacea2b6f8
5 changed files with 151 additions and 0 deletions
23
SWIG/Examples/python/swigrun/example.cxx
Normal file
23
SWIG/Examples/python/swigrun/example.cxx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/* File : example.cxx */
|
||||
|
||||
#include <Python.h>
|
||||
#include "swigrun.swg"
|
||||
#include "pyrun.swg"
|
||||
#include "pyrunalias.swg"
|
||||
|
||||
#include "example.h"
|
||||
|
||||
|
||||
Manager* convert_to_Manager(PyObject *py_obj)
|
||||
{
|
||||
Manager* c_ptr;
|
||||
swig_type_info *ty = SWIG_TypeQuery("Manager *");
|
||||
printf("manager ty %x \n", ty);
|
||||
if (SWIG_ConvertPtr(py_obj, (void **) &c_ptr, ty, 0) == -1) {
|
||||
c_ptr = 0;
|
||||
} else {
|
||||
Py_XINCREF(py_obj);
|
||||
}
|
||||
return c_ptr;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue