Executing assembler code with python

后端 未结 7 1684
长情又很酷
长情又很酷 2021-02-01 18:00

I want to execute assembly code inside a python script. Is that possible?

In C programming would be like this

static inline getesp(){
        __asm__(\"m         


        
7条回答
  •  轮回少年
    2021-02-01 18:28

    In theory, you could:

    1. Write a simple function in C that calls the assembly
    2. Use Cython or Pyrex to call that function from Python

    I have to admit that I haven't used either Pyrex or Cython, but they might be able to do what you need without having to go to the trouble of writing a full blown C extension.

提交回复
热议问题