How to use inline function in Cython

Viewed 1433

I am new in Cython and I have a problem compiling an inline function. The simplified code is:

cdef inline REG8(ulong addr):
   (<volatile_uchar_ptr *>(addr))[0]

I am trying to use the inline function inside a Python method:

def test(self):
    REG8(addr) = 0x08                         # ==> Error: "Cannot assign or delete this".
    (<volatile_uchar_ptr *>(addr))[0] = 0x08  # ==> OK. 

When I use the inline function REG8(), I get the compiler error: Cannot assign or delete this. However, the inserted code will work. I have no clue what is wrong here and will appreciate any help.

1 Answers
Related