I have used the NASM assembler to compile a simple assembly file (code below). I am going to then attempt to take this .obj
file created, and have Cython link it to a .pyd
file, so Python can import it. Basically I need a way of telling Cython to include an .obj
file for use with other Cython / Python code.
First, here is my assembly code:
myfunc.asm
;http://www.nasm.us/doc/nasmdoc9.html
global _myfunc
section .text
_myfunc:
push ebp
mov ebp,esp
sub esp,0x40 ; 64 bytes of local stack space
mov ebx,[ebp+8] ; first parameter to function
; some more code
leave
ret
I compile this code by using nasm -f win32 myfunc.asm
This gives me myfunc.obj
, which is what I want to include into a Cython compiled .pyd
.
I may be completely mislead, and there may be a better method to do this entirely. Is there a simple one liner extern
that I can do to declare an external object from Cython?
P.S. The label _myfunc
should be the entry point.