Try to cythonize, this and you will get a failure (second last line,
in Foo2 type declaration)..

cdef public     void bar1(): pass
cdef        api void bar2(): pass
cdef public api void bar3(): pass

ctypedef public     class Foo1 [type PyFoo1_Type, object PyFoo1_Object]: pass
ctypedef        api class Foo2 [type PyFoo2_Type, object PyFoo2_Object]: pass
ctypedef public api class Foo3 [type PyFoo3_Type, object PyFoo3_Object]: pass


Cython currently has two ways of *exporting* C-API's for third-party
consumption...

The first way, related to the "public" keyword, is based on
DL_EXPORT/DL_IMPORT stuff and CROSS-LINKING extension modules. I've
never ever did this, I'm not sure about how much portable this
approach is; distutils does not any provides support for this; no idea
how this works on Windows (I do not even know if it actually works).

The second way, releated to the "api" keyword, is based on standard
Python import mechanism, it is AFAIK portable to every platform Python
runs on; is the documented, recommended way to implement C-API
exporting, and moreover core CPython does this following this approach
(e.g. cStringIO in Python 2).

So IMHO, we should be able to remove that nasty restriction that 'cdef
api class' does not work because it ALSO requires the 'public'
declaration.

Related to C code (source and headers) generation, the safer thing to
do for next release is to provide both way of exporting if any or both
of 'public' and 'api' is used for cdef class declaration...



-- 
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