# Include assembler file in Cython compilation

I'm just experimenting with Cython files in sage and I'm quite happy that I found out how to specify arbitrary compiler flags in my .spyx file using cargs declaration.

But there is one other thing I want to do. Beside further C source files (which I can include using the cfile declaration) I also need to include a .s file containing assembler code.

Unfortunately, I cannot simply do it the way I include C files, because it gives me error: unknown file type '.s'

Any way I can pass the .s file within my .spyx file?

edit retag close merge delete

Sort by » oldest newest most voted

I am not sure you can do it with .spyx file (that is a special mix between Cython and sage). Though a cython file (.pyx) can be converted to a .c file (this is Cython job). Then you can compile it with some extra C code (that may contains assembler code). Have a look at Cython code compilation.

more

Sorry I post a wrong link. It is now fixed.

( 2016-01-09 13:19:01 -0500 )edit

thank you. In this case it seems that staying with Cython involves a bit overhead. I solved it by compiling the C and asm code to a .so lib and build an interface with ctypes around it.

( 2016-01-12 04:57:04 -0500 )edit