On Fri, May 15, 2009 at 11:49 AM, Hoyt Koepke <[email protected]> wrote: >> The sig is: struct iovec *hdr_names[], struct iovec *hdr_values[] > > Okay, this is probably the problem then. It is expecting an array of > pointers to individual structs, not a pointer to an array of structs. > When it iterates over the array, it iterates over the itvec** > instance, expecting an iovec* at each iteration. What you need to do > with your code is create an intermediate array that is what it wants. > If there is only one element, then the two cases are the same, so it > would not segfault. Something like: > > cdef iovec** ptrarray = <iovec**>malloc(n*sizeof(iovec*) > > for 0 <= i < n: > ptr_array[i] = &hrd_array[i] > > ... > > free(ptr_array) >
I don't have a million to give you Hoyt , so just accept my thank you's. I tried this: cdef iovec** ptr_array_n = <iovec**>malloc(total_count * sizeof(iovec*)) cdef iovec** ptr_array_v = <iovec**>malloc(total_count * sizeof(iovec*)) ... ptr_array_n[0] = &hdr_names[0] ptr_array_v[0] = &hdr_values[0] ptr_array_n[1] = &hdr_names[1] ptr_array_v[1] = &hdr_values[1] call_function(...,ptr_array_n,ptr_array_v,...) I'll return to my earlier code and try that. Mohamed. _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
