[Image-SIG] Buffer Object

Russian Spy russianspy@visto.com
Sat, 17 Mar 2001 19:33:14 -0800


Hello..
I've got a problem (actually two of them, but I hope to solve both of the=
m using Buffer Objects).  First of all, I need to transfer large quantity=
 of data between C-code and Python.  I'd like to make it as easy as I can=
=2E  The best way would be to have a string in Python and a char* pointer=
 and an integer representing size in C.  I think Buffer Objects would be =
great for that.

Quick Setup: I'm using Python2.0, Swig, PIL, NumPy and Numerical Recepies=
 on the C side.  (I was thinking about adding PyOpenGL, but let's no go t=
oo far ;-) )

The String object will contain 0 bytes (ie NULL bytes) and that causes a =
bit of a problem. =20

First Problem: I'm still working it out on the Swig side, but can I creat=
e a function that takes 2 arguments on Python side and 3 on C side? (ie. =
I add the size?)

Second Problem:  How do I access the Buffer Object.  I have some code tha=
t generates a Buffer Object, but I have been unable to find any examples =
of accessing the information.  I think the write function in Python sourc=
e code has it. Sorry, I have not been able to look at it yet.  If anyone =
has an example without me going through pages of code that would be great=
!

Thanx a lot,

Grzegorz Dostatni
_________________________________________________________________________=
__
Visit http://www.visto.com/info, your free web-based communications cente=
r.
Visto.com. Life on the Dot.