[Tutor] writing to an address in memory

Dennis Lee Bieber wlfraed at ix.netcom.com
Tue Jun 14 11:37:35 EDT 2022


On Tue, 14 Jun 2022 06:31:56 +0100, Nathan Smith <nathan-tech at hotmail.com>
declaimed the following:

>Hi!
>
>
>I'm working with a library which written in C and has a callback 
>function for listening for data, basically.
>
>Essentially any time it wants new data, it calls the callback with 
>arguments:
>
>callback(handle, buffer, length)
>
>Where bufffer is a pointer to the buffer to write the data to.
>
>
>I know how to read the data (using ctypes.from_address) but I don't know 
>how to write data to it?

	Do
https://docs.python.org/3/library/ctypes.html#passing-pointers-or-passing-parameters-by-reference
https://docs.python.org/3/library/ctypes.html#ctypes.byref
https://docs.python.org/3/library/ctypes.html#callback-functions
provide any hints (caveat: I've not used ctypes, I just read documentation
<G>)



-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed at ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/



More information about the Tutor mailing list