[Pyrex] Wrapping "typedef struct _A A;", second pass

Edward C. Jones edcjones at erols.com
Wed Jun 4 20:11:06 CEST 2003


How do I make the following work?

Thanks,
Ed Jones

-------------------
tds.h:

#include <stdio.h>

# I want A to be an opaque C type at the Pyrex level.
struct _A {
     int i;
};

typedef struct _A A;

void munge(A a);

------------------
tds.c:

#include "tds.h"

A make(int i)
{
     A a;
     a.i = 7;
     return a;
}

void munge(A a)
{
     printf("%d\n", a.i);
}

-----------------
wrapped.pyx:

cdef extern from "tds.h":
     ctypedef struct A
     A make(i)
     void munge(A a)

cdef A a
a = make(7)
munge(a)





More information about the Pyrex mailing list