Mohamed Lrhazi wrote:
> On Mon, Apr 27, 2009 at 9:58 AM, Lisandro Dalcin wrote:
>> What does not work? Cython or the C compiler?
>>
>> I really do not like these generic "ctypedef void* FOO". I would do
>> this:
>>
>> cdef extern from "header.h":
>>   cdef struct struct_FOO "FOO":
>>      pass
>>   ctypedef struct_FOO* FOO
>>
>>
>> Now, you said the C example does "something like":
>>
>> static FOO s_foo=NULL;
>>
>> Are you sure it does that? In such case, it should work. If not,
>> please provide us more info about the Cython or C compiler failure...
>
> I tried the following:
>
> cdef extern from "mylib.h":
>   cdef struct struct_FOO "FOO":
>     pass
>   ctypedef struct_FOO* FOO
>   int mylib_func(FOO* c)
>
> cdef FOO s_foo
> s_foo=NULL
> mylib_func(&s_foo)
>
> Cython does not complain. gcc gives a warnings: assignment from
> incompatible pointer type
> gcc completes fine, but when I run my code, I get a seg fault at that
> last function call..

Could you please post the relevant parts of

a) the C code generated by Cython for the above and
b) the original definitions used in the C header files and
c) the output of the C compiler

It's cumbersome to collect all of these from separate e-mails, and to ask
back for more details on each new try.

Stefan

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

Reply via email to