Ask Your Question
1

Include assembler file in Cython compilation

asked 2016-01-09 17:38:14 +0100

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
0

answered 2016-01-09 19:46:28 +0100

vdelecroix gravatar image

updated 2016-01-09 20:54:38 +0100

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

Comments

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

vdelecroix gravatar imagevdelecroix ( 2016-01-09 20:19:01 +0100 )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 11:57:04 +0100 )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

Stats

Asked: 2016-01-09 17:38:14 +0100

Seen: 404 times

Last updated: Jan 09 '16