Consider the following stuff:

cdef            void* spam0(object o) except NULL: return NULL
cdef public     void* spam1(object o) except NULL: return NULL
cdef        api void* spam2(object o) except NULL: return NULL
cdef public api void* spam3(object o) except NULL: return NULL

cdef                class Foo0: 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

I thing all should be valid, however "ctypedef api class Foo2" is not
the case. Fixing this is more or less easy...

What is not clear to me is the following: Should "public", "api", or
"public api" have any semantic diference? We could argue that "api" is
related to C-API exporting the Python way (using capsule/cobject), and
that "public" is related to the linker-way, using DLL export
mechanisms (__declspec(dllexport) or GCC visibility attributes). In
such view, the two mechanisms are independent and can coexist, so a
"public api" function or type could mean that we want BOTH mechanisms
for exporting stuff... That way, these functions/types could be
accessed via ext module interlinking (pretty easy in Linux, not sure
about OS X or WinDog), or using the very portable Python way using
capsules/cobjects (however, this way requires requires some
hand-written C to get the symbols, unless you use Cython, of course,
but think about other wrapper tools).

However, I'll refresh your memory about some Greg's comments some time
ago. Greg said that he never intended to provide DLL export
mechanisms, and in fact he just wanted to make stuff available across
compilation units (i.e, make stuff available to other C source files
being compiled ALONGSIDE the generated C sources to build the final
ext module). If we enforce this, I mean we are not going to support
ext module interlinking, then almost the usages of DL_IMPORT/DL_EXPORT
macros are a nonsense and should be removed, alongside almost all
these dll_linkage arguments in many methods.

The whole import/export stuff is a bit of mess, and I would really
want to clean this up... IMHO, it would be nice to support ext module
interlinking (probably just because I'm a Linux user and do not want
to restrict my favorite platform). But if you think this is not worth
the effort, then I'm fine too, and then "public" and "api" would mean
basically the same: export/import stuff using capsules/cobjects.

So... What do you think?



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