Python extension modules
emdpek
emdpek at chron.com
Fri Nov 2 10:59:16 EST 2001
Thanks for the response, Mark!
> Check out the struct module. It allows you to pack and
> unpack "blobs" of data (usually in a string), given a
> format string.
The one drawback is the "native" C struct being returned by
the library may have contain several megabytes of data.
Converting these values back and forth between C and Python
might prove too much overhead. (Correct me if I am
wrong!!!)
Just a thought, but are there examples Py_BuildValue's "O&"
modifier? This might provide another solution...
> > static PyObject*
> > MyNew_getattr(MyNew *self, char *name)
> You should use Python declarations exactly - use
> "PyObject" instead of "MyNew". MyNew may fail in some C++
> scenarios.
I was wondering about this. Guess I really need a cast:
static PyObject*
instance_method(PyObject *self, PyObject *args) {
MyNew *real_self = (MyNew *)self;
etc...
}
And in response to other posts, today I spend the day
learning SWIG. Thanks for the help!
emdpek
More information about the Python-list
mailing list