Glad you were able to figure everything out. Also, of note, malloc  
and free are used just as in C to allocate memory (heap-allocated  
structs, pointers, etc.)

- Robert

On Jul 19, 2009, at 10:50 PM, David P. Novakovic wrote:

> oh yes, I feel like an idiot... for anyone as idiotic as me for who  
> finds this post, simply declaring the variable "instantiates it"  
> just like in C... :)
>
> On Mon, Jul 20, 2009 at 3:25 PM, David P. Novakovic  
> <[email protected]> wrote:
> I found http://ldots.org/pyrex-guide/ which alerted me to being  
> able to use NULL ... still trying to figure out how to create an  
> instance of the struct...
>
>
> On Mon, Jul 20, 2009 at 3:17 PM, David P. Novakovic  
> <[email protected]> wrote:
> Hey,
>
>
> i'm trying to create an instance of a struct from an external header:
>
> cdef exern from "api.h":
>     ctypedef struct foo_config:
>         int member_1
>         ...
>
>
> cdef class Session:
>     foo_config config
>
>     def __init__(self):
>         self.config = foo_config()
>
>
>
>
> Also, I need to create a void pointer for a struct and pass that  
> into the c library so it can create an instance of a struct in the  
> memory, I can't see a way of doing this.. when i try and assign  
> None to an uninitialised variable the cython compiler complains  
> about a type mismatch.
>
> Any help would be greatly appreciated :)
>
>
> David
>
>
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev

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

Reply via email to