ctypes accessing functions with double pointers

Chris Rebert clp2 at rebertia.com
Mon Nov 7 17:29:46 EST 2011


On Mon, Nov 7, 2011 at 2:06 PM, Eleftherios Garyfallidis
<garyfallidis at gmail.com> wrote:
> Hello,
>
> Is it possible using ctypes to call C functions from a shared object
> containing double pointers e.g. int foo(float **i) and if yes how?

(Untested conjecture:)

import ctypes
# ...create ctypes_wrapped_foo...
the_float = ctypes.c_float(42.1)
float_ptr = ctypes.byref(the_float)
i = ctypes.byref(float_ptr)
result_integer = ctypes_wrapped_foo(i)

Cheers,
Chris



More information about the Python-list mailing list