[Cython] Calling conventions on Windows
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Fri May 8 22:28:55 CEST 2009
Lisandro Dalcin wrote:
> I'm having a hard time trying to make mpi4py compatible with Microsoft
> MPI. All the MPI calls are annotated with __stdcall, and callbacks
> functions (in my case written in Cython) should also be. But other MPI
> implementations (MPICH2 and DeinoMPI) does different, they require
> __cdecl. I cannot figure out how to solve that without the help of
> Cython....
>
> I'm thinking about ADDITIONALLY supporting the following sintax:
>
> cde int "CALL_SPEC" somefunc():
>
> then I would be able to pass -DCALL_SPEC=__xxx or even conditionally
> "#define CALL_SPEC __xxx" in some header...
>
> This could have other uses as well, as the string literal could
> provide other annotations (like __attribute__ stuff in GCC).
>
> I've already modified the parser and all seems to work. The only thing
> left is to make Cython not so strict about the signatures
Could we have a decorator instead, perhaps? Or some way of declaring a
new callspec?
ccallspec __stdcall
...
I'm just thinking about the
cdef extern unsigned int public inline __stdcall foo "realfoo" ()
expect+: ...
>
> I mean, if I use a bare string literal for annotating the function,
> then the function types
>
> int "ABC" foo()
>
> int "XYZ" bar()
>
> would be treated as equivalent to the unannotated:
>
> inf fun()
>
> What do you think?
>
> BTW, we should add support for __fastcall calling conventions, like this
>
> int __fastcall func()
>
> -
>
--
Dag Sverre
More information about the Cython-dev
mailing list