[Tutor] passing values and C pointers

Brad M thebigwurst at gmail.com
Sat May 5 22:17:20 EDT 2018

Hi all:

Although I have college C++ 101 and Python 101 down my belt, I wan't
taught how to read a reference manual to figure this out :(

Say I have an array of values, say addresses or int produced by a c module/
c function that's in a DLL , how do I pass that array back to
the python code?

from ctypes import cdll
mydll = cdll.LoadLibrary('mydll')
a = mydll.c_get_data()

or, as I have learned in C, I can use malloc to create a linked list(new
beast for me) and then return the head pointer to the previous C function.

But eventually I am going to pass that C pointer back to python, right?
1) how do i do that,
2) how do do work on that data on that pointer? let's say the pointer
points to a linked list.

Thanks all!

More information about the Tutor mailing list