Dag Sverre Seljebotn wrote:
> 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+: ...

Sorry, accidentally hit send. The order is wrong but you get my point 
(and I forgot to add "api").

>> I mean, if I use a bare string literal for annotating the function,
>> then the function types
>>
>> int "ABC" foo()

Well consider

cdef extern:
     int "__fastcall" foo "realfoo" ()

It's not a very readable syntax (did the real name go before or after? 
With this change, the compiler won't complain if you try the wrong one 
first)

If one instead had a flexible mechanism for declaring "__fastcall" and 
friends so that the quotes can disappear, it looks much more readable:

cdef extern:
     int __fastcall foo "realfoo" ()

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to