[PyKDE] function pointers in sip

Phil Thompson phil at river-bank.demon.co.uk
Sat Jan 11 13:51:00 GMT 2003


On Friday 10 January 2003 5:02 pm, Jim Bublitz wrote:
> Phil -
>
> There was a question on the list earlier today about doing function
> pointers in sip, eg:
>
>     static void(*clearScreen)(uchar w, uchar h);
>
> or perhaps just:
>
>     void(*clearScreen)(uchar w, uchar h);
>
> Is it possible to do these in sip? If so, could you provide some
> info on what's necessary, limitations, etc? I assume from the
> "static" the original poster was interested in function pointers as
> class members, and I have a few of those in PyKDE also. I don't
> believe there are any examples in PyQt.

They are not explicitly supported. Whether you can do anything useful with 
handwritten code depends on what you want to do with them.

If you simply want to pass the pointer around then you can declare clearScreen 
as a void *.

If you want to be able to assign a Python function to clearScreen and have it 
called then things get a bit more difficult. I'm sure it's possible to do 
something - although SIP may not allow you to provide handwritten code 
everywhere you might need to.

Phil




More information about the PyQt mailing list