Could you tell me the EXACT type definition for "iovec" in your C header file?
--- On Thu, May 14, 2009 at 9:43 PM, Mohamed Lrhazi <[email protected]> wrote: > Hello, > > I have a C -lib function requring a params in this form: struct > iovec *hdr_names[] > When I declare the above function, as from external .h file, I use the > same syntax, minus the word strurct: iovec *hdr_names[] > > Now to create this data, I do this: > > cdef iovec *hdr_names=NULL > hdr_names=<iovec*>malloc(total_count * sizeof(iovec)) > > then go some loops and checks, filling the iovecs like this: > > hdr_names[ii].iov_base = <char*>hdr_n > hdr_names[ii].iov_len = len(hdr_n) > > > then dump eveything just to be sure, like this: > > for ii in range(total_count): > print "hdr_names[%d] : "%ii, > PyString_FromStringAndSize(<char*>hdr_names[ii].iov_base, > hdr_names[ii].iov_len) > print "hdr_values[%d]: "%ii, > PyString_FromStringAndSize(<char*>hdr_values[ii].iov_base, > hdr_values[ii].iov_len) > > then pass it to the C function like this: modify(hdr_names) > > That fails to compile: Cannot assign type 'iovec *' to 'iovec **' > So I try: &hdr_names > > This compiles, but causes my program to crash with sigfault, right at > that function call. > > I tried various other ideas.... but what is the correct way > anyways.... I might have other issues causing the sigfaults, but > wanted to be sure about the very syntax.. > > Thanks a lot, > Mohamed. > _______________________________________________ > 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
