Efficient data flow between orthogonal C extensions?
Pierre Schnizer
P.Schnizer at nospam.gsi.de
Fri Jun 6 03:11:48 EDT 2003
More information about the Python-list mailing list
Fri Jun 6 03:11:48 EDT 2003
- Previous message (by thread): Efficient data flow between orthogonal C extensions?
- Next message (by thread): Efficient data flow between orthogonal C extensions?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
mlh at furu.idi.ntnu.no (Magnus Lie Hetland) writes: > What am I doing wrong? Now you also have to wrap the callback which has to have the signature: void callback(char *); This will result in a "variable" 0x......._p_f_p_char__void, basically the pointer to the function and the adress. Swig uses the appendix _p_f_p_char__void to "typecheck" the input. I uploaded an example at: http://www.itp.tu-graz.ac.at/~pierre/swig_example.tar.gz I added also the swig generated files, so you can run the test. You will need swig1.3 to generate the interface files yourself. Note that the shared object must be named _foo.so Here a short summary. I changed the signature of the functions. The return values are considered as error flags. Also a void * pointer was included for additional arguments. If you are interested I could show you how to convert them to Py exceptions using typemaps. I need a struct to pass the callback and its argument to the python function. Swig can generate the constructor and destructor aided with the extend structure. In foo.c you will find the c callback "bar" and the helper function "py_bar". test_foo.py executes the functions. py_bar needs to get a handle for the PyObject to call. Yours sincerely Pierre > -- > Magnus Lie Hetland "In this house we obey the laws of > http://hetland.org thermodynamics!" Homer Simpson
- Previous message (by thread): Efficient data flow between orthogonal C extensions?
- Next message (by thread): Efficient data flow between orthogonal C extensions?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list