That worked. Many thanks Eryk.
Rob
On 30/06/2022 23:45, Eryk Sun wrote:
On 6/30/22, Rob Cliffe via Python-list wrote:
AKAIK it is not possible to give ctypes a bytearray object and persuade
it to give you a pointer to the actual array data, suitable for passing
to a DLL.
You're overlooking
Il giorno venerdì 1 luglio 2022 alle 00:46:13 UTC+2 ery...@gmail.com ha scritto:
> On 6/30/22, Rob Cliffe via Python-list wrote:
> >
> > AKAIK it is not possible to give ctypes a bytearray object and persuade
> > it to give you a pointer to the actual array data, suitable for passing
> > to a
On 6/30/22, Rob Cliffe via Python-list wrote:
>
> AKAIK it is not possible to give ctypes a bytearray object and persuade
> it to give you a pointer to the actual array data, suitable for passing
> to a DLL.
You're overlooking the from_buffer() method. For example:
>>> ba = bytearray(10)
I have an application in which I wanted a fixed-length "array of bytes"
(that's intended as an informal term) where I could read and write
individual bytes and slices, and also pass the array to a DLL (one I
wrote in C) which expects an "unsigned char *" parameter.
I am using ctypes to talk to