Hi,

Can anyone point out where I am going wrong?

// foo.h

#ifndef __FOO_H__
#define __FOO_H__

typedef struct
{
    int fd;
} foo_t;

foo_t* init(void);

#endif


// foo.c

#include "foo.h"
#include <stdlib.h>

foo_t* init(){
    foo_t* foo = malloc(sizeof(foo_t));
    return foo;
}


// foo.pyx

cdef extern from "foo.h":
    ctypedef struct foo_t:
        int fd

    foo_t* init()

class Bar:
    def __init__(self):
        self.__foo = self.__open()

    def __open(self):
        cdef foo_t *foo
        foo = init()
        return foo


Results in the error:
/test/foo.pyx:14:12: Cannot convert 'foo_t *' to Python object

Cython version 0.9.6.14

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

Reply via email to