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