On May 14, 2009, at 9:28 PM, Mohamed Lrhazi wrote: > On Fri, May 15, 2009 at 12:16 AM, Lisandro Dalcin > <[email protected]> wrote: >> On Fri, May 15, 2009 at 1:03 AM, Mohamed Lrhazi <[email protected]> >> wrote: >>> >>> I tried first with commented version, then the uncommented: >>> >>> cdef extern from "sys/uio.h": >>> # ctypedef struct iovec "struct iovec": >>> # void *iov_base >>> # size_t iov_len >>> cdef struct iovec: >>> void *iov_base >>> size_t iov_len >>> >>> >>> With the first, it fails whenever iovecs are declared, like this: >>> >>> uint32_t max_pending_trans >>> char *traffic_class >>> struct iovec *req_hdrs >>> ^ >> >> But if you use the first, commented version, then do not use "struct >> iovec *req_hdrs", just "iovec *req_hdrs" !! >> > > I just retired that way, it compiles, but then sigfaults. :( > >> >>> >>> With the second, it compiles, but then my program sigfaults. I >>> should >>> add that it never sigfaults if I only have one value in the >>> passed in >>> array of structs, only if there are more. >>> >> >> In your original code, when you fill >> >> hdr_names[ii].iov_base = <char*>hdr_n >> hdr_names[ii].iov_len = len(hdr_n) >> >> What exactly is "hdr_n"? A Python string? Where "hdr_n" comes from? >> The iovec entries in hdr_names are supposed to be readonly? Or are >> you >> trying to receive data on them? >> > > hdr_n is a string that came from Python... maybe full code with help > you better see my mistakes :) http://pastebin.com/dbd60984 > > that function is called by code in Python land, passing lists or > header names to delete, or dicts of header name/value to add/replace.
See http://docs.cython.org/docs/language_basics.html#caveats-when- using-a-python-string-in-a-c-context (Perhaps "Caveats" is too weak of a warning to use here...) - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
