Help with pointers when calling from python to C
Nobody
nobody at nowhere.com
Sun Oct 10 06:32:45 EDT 2010
On Fri, 08 Oct 2010 18:02:15 +0200, Jonas H. wrote:
> On 10/08/2010 05:23 PM, Carolyn MacLeod wrote:
>> "How do I pass an integer by reference to a C function?"
>
> That's impossible in pure Python. The only thing I can think of is a
> wrapper in C.
I didn't see the original message, but if you're using ctypes, create a
c_int value and use byref():
i = c_int(42)
myfunc(byref(i))
print i
http://docs.python.org/library/ctypes.html#passing-pointers-or-passing-parameters-by-reference
More information about the Python-list
mailing list