On Thu, Sep 4, 2008 at 10:39 AM, Dag Sverre Seljebotn
<[EMAIL PROTECTED]> wrote:
> What you can do is create a header file like this:
>
> #define setup_func_context() MyInitializerClass __var
>
> i.e. turn it into a call using a macro, and then call that function from
> Cython:
>
> cdef extern from "myheader.h":
>     void setup_func_context()
>
> cdef class T:
>     def __cinit__(self):
>         setup_func_context()
>         .... do stuff ...


Thanks! Works perfectly.

didier

>
> Of course it is rather obscure as that function call makes something
> happen when you exit the function as well, but it should work. You can
> always make modifications (pass in the variable name to use, create
> accessor macros to get hold of the variable etc.) to make it work for you.
>
> --
> Dag Sverre
> _______________________________________________
> 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