Hello,

I have a cdef'ed class with a cdef'ed method that looks something like this:

cdef class MyClass:
   cdef void myfunc(self, double *x):
       ... (function contents) ...

   def execute():
       call_func( &(self.myfunc) )

I'm linking to a function in an external library that accepts a
function pointer of similar signature

cdef extern from 'somelibrary.h':
   cdef void call_func(void (*func)(double *x))

However, I receive an error at compile time that a function of type

void (*)(MyClass, double *)

cannot be converted to a function of type

void (*)(double *)

I was wondering there is a way to unbind this myfunc class method so
that it can be properly sent to this external function. I know that I
can simply create a function pointer attribute as part of the class
but it would seem cleaner for a user to subclass and override myfunc
instead of subclassing and setting the value of function pointer
attribute from within an overridden __cdef__ method.

Thank you in advance for any hints or suggestions!

-- 
Chris Swierczewski
[email protected]
blog: cswiercz.wordpress.com
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to