Passing Function Pointers from C to an embedded python environment

Hi All,
I'm not sure if this is the right forum to be bringing this up in, but here goes anyway:
I have a program which we're trying to embed python in, the goal being that we can use python to tweak various algorithms and extract data from the core system. To achieve this, and be able to access this data, it's my intention to pass call backs from the host C program into the python interpreter which will extract the data and form it into python objects for further processing -- typically displaying on a webserver etc ...
Is there a sensible mechanism to acheive this, or is a different approach recommended? I've had a deep trawl through the extending and embedding document but nothing obvious has presented itself. All help and suggetions are gratefully received.
Thanks in advance,
paddy
-- ----------( I've told you all my secrets, but I lied about )---------- ----------( my past, so send me off to bed for ever more ... )----------

Off the top of my head, it sounds like you need to create your own PyObject implementation, which can hold your function pointers and make use of them via methods on the object. Alternatively, something like ctypes would let you call the function pointers directly, although without much safety - but depending on your requirements, that might be fine.
Mark

Off the top of my head, it sounds like you need to create your own PyObject implementation, which can hold your function pointers and make use of them via methods on the object. Alternatively, something like ctypes would let you call the function pointers directly, although without much safety - but depending on your requirements, that might be fine.
Mark
participants (2)
-
Mark Hammond
-
Patrick Moore