[Pyobjc-dev] Variable-length array argument
Brought to you by:
ronaldoussoren
|
From: Orestis M. <or...@or...> - 2009-03-24 14:13:55
|
Hello,
I'm trying to call NSBitmapImageRep getPixel:atX:y:. The issue is that
the signature is like this:
- (void)getPixel:(NSUInteger[])pixelData atX:(NSInteger)x y:(NSInteger)y
And expects a pointer to an array, which is variable in length as it
depends on the type of the bitmap representation. Here's the things
I've tried:
* Passing None: exceptions.TypeError: Need explict buffer for
variable-length array argument
* Passing objc.NULL: works but doesn't return anything :/
* Passing lists/strings: exceptions.ValueError: argument 0 must be
None or objc.NULL
* Passing an array.array('i'): exceptions.ValueError: type mismatch
between array.array of i and and C array of I8i12i16
* Passing an array.array('I'): bus error
* Passing an array.array('I'), but initialised to size 100 with
zeroes: exceptions.SystemError: NULL result without error in
PyObject_Call
I've run out of things to try. So far as I can trace the code, I need
to pass something that is accepted by PyObject_AsWriteBuffer, and can
also be converted to this complex c array by PyObjC_PythonToCArray.
Any pointers on how I can do that?
Thanks,
Orestis
--
or...@or...
http://orestis.gr/
|