Sujet : Re: That depends... (Was: Regarding assignment to struct)
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 03. May 2025, 03:28:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vv3v18$2im7b$2@dont-email.me>
References : 1 2 3 4
User-Agent : Pan/0.162 (Pokrosvk)
On Sat, 3 May 2025 01:13:48 -0000 (UTC), Lew Pitcher wrote:
But... I remembered this (apparently) seldom-used feature of being able
to pass a struct by value up and down the chain (down, as a function
argument, up as a function return value). As I've not done this before,
and I've not /seen/ it done in other peoples code, I wonder how viable
a solution it might be.
As someone who has written lots of Python wrappers around C libraries, one
thing I could never get to work right was passing structs as arguments by
value. (The case of returning a struct as a function result never arose.)
Presumably this was a limitation of libffi, which lies at the heart of the
Python ctypes module.
Luckily, in the one case where this happened, there were alternative API
calls I was able to use.