Hi again,

Am 04/19/2008 12:37 AM schrieb Robert Bradshaw:
> Try doing something like
> 
> cdef extern from *:
>     ctypedef char* const_char_ptr "const char*"
> 
> cdef foo_c(const_char_ptr s):
>     print s
> 
> foo_c("yo")

I've found a new problem with this approach. I've declared a function

cdef public void plug_observ_data(plugDefinition* p, const_char_ptr i):
        print "Plugin '%s' ... type '%s'" % p.name, i

Compiles without a problem but results in a segfault when this function
gets called from a C lib. Output is generated and afterwards the
segfault occurs. Seems to be related to the conversion to Python
objects, because if I use a standard printf there is no problem. Every
other operation that requires a conversion to Python objects results in
a segfault to.

To my surprise it seems to be unrelated to the const thing. Not using i
and only doing some conversions with p results in the same problem.

Is there any chance to get this working? I've tried reading the C code
but that's nearly impossible for me.

Johannes



Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to