views:

82

answers:

2

I'll have couple of python functions I must interface with from the assembly code. The solution doesn't need to be a complete solution because I'm not going to interface with python code for too long. Anyway, I chewed it a bit:

  • What does a python object look like in memory?
  • How can I call a python function?
  • How can I pass python objects as python objects for ctypes interface?
  • Could ctypes interface make my work easier in any alternative way?
+1  A: 

You will want to read and understand Extending and Embedding the Python Interpreter and the Python/C API Reference Manual. This describes how to interface with Python from C. Everything you can do in C you can equivalently do in assembly code too, but you're on your own for this as it is not directly described from a Python perspective.

Greg Hewgill
A: 

It's certainly doable, but you'd have a much easier time reading the C API docs and writing a go-between function in C.

Come to think of it, C is highly recommended, since it may be hard to tell which of the routines you're calling might be implemented as preprocessor macros.

HUAGHAGUAH