As Greg pointed out, this has nothing to do with external
declarations. The actual issue is when you need to implement in Cython
code a callback function.

In my particular issue, these callbacks have to respect a standardized
API. And the problem is that different implementations of that
standardized API use different calling conventions... Then I want my
Cython code to work with any of these implementation, but I only see
two solutions:

1) Implement all my callbacks in C and include them with 'cdef
extern'. But then I've just lost the power of Cython for implementing
C functions, particularly when Python objects are involved and the GIL
has to be properly managed.

2) Modify Cython to accept any string literal instead of just
__stdcall/__cdecl/__fastcall. Then the contents of that literal could
be a macro and I would be able to control its actual contents via the
C preprocessor.

Can any of you figure out an alternative to (2) to save me (or any
other with similar issues) from (1) ??

--

On Sat, May 9, 2009 at 10:00 PM, Greg Ewing <[email protected]> wrote:
> Dag Sverre Seljebotn wrote:
>
>> cdef extern:
>>      int "__fastcall" foo "realfoo" ()
>
> Why aren't you getting this from a header file?
>
> --
> Greg
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to