Re: Byte arrays and DLLs

2022-07-03 Thread Rob Cliffe via Python-list
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

Re: Byte arrays and DLLs

2022-07-02 Thread Edmondo Giovannozzi
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

Re: Byte arrays and DLLs

2022-06-30 Thread Eryk Sun
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)

Byte arrays and DLLs

2022-06-30 Thread Rob Cliffe via Python-list
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