[Cython] Calling conventions on Windows
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Mon May 11 20:18:24 CEST 2009
Lisandro Dalcin wrote:
> On Mon, May 11, 2009 at 11:52 AM, Dag Sverre Seljebotn
> <dagss at student.matnat.uio.no> wrote:
>> Dag wrote:
>>> Yes, as I proposed, some kind of syntax to declare your own calling
>>> convention; e.g.
>>>
>>> cdef callspec __mycall "__mycall"
>>>
>>> cdef __mycall int foo(): return 3
>
> I really like this, but I also understand that it is going to be a
> burden to implement.
>
>> Alternatively:
>>
>> from cython import callconvention
>>
>> @callconvention("__mycall")
>> cdef int foo(): ...
>>
>> though it might be too long? (Shorter name possible on decorator too.)
>
> @callspec("__mycall") seems short and explicit enough for me.
+1. Especially since no change in the parser is required :-)
(Should we have a +1 from Robert or Stefan as well you think?)
If you end up doing this, here's one (of many) strategies:
Compiler directives (Options.py and somewhere in ParseTreeTransforms.py)
must be extended to accept string arguments and possibly extended with a
mechanism to make directives only valid in certain contexts (no "with
callspec(...):" :-) ).
(Technically this is perhaps not a compiler directive, but it's an easy
way of implementing it and not *too* far off...)
--
Dag Sverre
More information about the Cython-dev
mailing list