[Pyrex] C public functions conflict with protos in headers

Phil Frost indigo at bitglue.com
Tue Jun 29 01:55:07 CEST 2004


I'm trying to use Pyrex to implement a C API (part of libc, actually),
and I'm having problems when I try to compile the generated code. To
include the C header, i do:

cdef extern from 'unistd.h':
  pass

then I implement write() like so:

cdef public int write( int fd, void *buf, size_t len ):
  pass

when I compile this, gcc tells me:

i386/py_file.c:45: error: conflicting types for `write'
include/unistd.h:53: error: previous declaration of `write'

The reason seems to be that pyrex emits prototypes for write(), which
arn't quite the same as the write in unistd, because I've had to drop
the 'const' for Pyrex. There is also the issue of conditional types,
which I've posted separately.

I can't really not include the header, because I also require a
structure defined in another file that eventually includes unistd.h
anyway. Is there any way (preferably clean, but I'm open to suggestions)
to accomplish this?




More information about the Pyrex mailing list