Ask Your Question

Include assembler file in Cython compilation

asked 2016-01-09 10:38:14 -0500

firefexx gravatar image

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 flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2016-01-09 12:46:28 -0500

updated 2016-01-09 13:54:38 -0500

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.

edit flag offensive delete link more


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

vdelecroix gravatar imagevdelecroix ( 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.

firefexx gravatar imagefirefexx ( 2016-01-12 04:57:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-01-09 10:38:14 -0500

Seen: 82 times

Last updated: Jan 09 '16