well, i tried your way Lisandro, and it compiled fine, but upon importing
the module, it raised an error along the lines of "it appears IplImage is
not of the right type".

Dag's method works, but I'm still gonna try to find something cleaner.

Chris

On Fri, May 22, 2009 at 11:05 AM, Chris Colbert <[email protected]> wrote:

> Ok, I get what your saying. that's a good idea and I think it's a little
> cleaner than casting during the call.
>
> Thanks!
>
> Chris
>
>
> On Fri, May 22, 2009 at 10:17 AM, Lisandro Dalcin <[email protected]>wrote:
>
>> On Fri, May 22, 2009 at 1:49 AM, Chris Colbert <[email protected]>
>> wrote:
>> > is 'handle()' a method that is called internally when passing extension
>> > types as parameters?
>> >
>>
>> No, it is a "polymorphic" method you have to manually call yourself.
>> Instead of doing "self.thisptr", you do "self.handle()", just to extra
>> parents.
>>
>> > I'm exposing a C function to Python as follows:
>> >
>> > def cvSomeFunction(CvArr image):  #image should be able to be CvArr
>> IplImage
>> > or CvMat
>> >      c_lib.cvSomeFunction(image.thisptr)    # C func prototype = void
>> > cvSomeFunction(CvArr* image) and image can be CvArr* IplImage* or CvMat*
>> >
>>
>> If you use my trick, the functions should be implemented like this:
>>
>> def cvSomeFunction(CvArr image):
>>    c_lib.cvSomeFunction(image.handle())
>>
>> Did you get the idea ?? Perhaps I'm not being clear enough.
>>
>> --
>> Lisandro Dalcín
>> ---------------
>> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
>> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
>> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
>> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
>> Tel/Fax: +54-(0)342-451.1594
>> _______________________________________________
>> 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