[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: alien question: how to get the address of a buffer object?
- From: Cosmin Apreutesei <cosmin.apreutesei@...>
- Date: Mon, 27 Jul 2009 18:31:54 +0300
> The only way right now is to use another buffer:
>
> buf = alien.buffer()
> buf2 = alien.buffer(4) -- for 32 bit pointers
It would be nice to have buf:address() and maybe a 'p' type for
struct.pack/unpack that would work with alien buffers directly just as
functions do oink oink :) would allow me to stick buffer pointers in
those strings as clearly as anything else.
> BTW, have you thought about using a buffer instead of struct.pack?
I use struct.pack because it emulates the structs already found in the
C headers (makes for clean documenting), and because I can fix the
byte order and alignment. But buffers are better for big mutable
arrays I guess.