[PyQt] Wrapping a C library with SIP: suggestions/wishlist

Phil Thompson phil at riverbankcomputing.co.uk
Sun Apr 8 12:58:44 BST 2007


On Sunday 08 April 2007 12:35 pm, Miguel Lobo wrote:
> Hi,
>
> I'm using SIP 4.5.2 to wrap a C library and I've noticed the following:
>
> * SIP does not recognise C prototypes without parameters i.e. "void
> myfunction(void);"; you have to replace "(void)" by "()".  It would be nice
> if SIP supported this syntax (which I believe is valid in C++ too).
>
> * SIP does not allow opaque structs i.e. "struct mystruct;".  To make this
> work I've had to do the following:
>
> struct mystruct /Abstract/ {
> %TypeHeaderCode
>
> %End
> };
>
> Again, it would be nice if the C syntax was supported.
>
> Secondly, just as an idea, I think it would be useful to have some simple
> way of specifying read-only global variables and struct members e.g:
>
> const float x = 0.2f;
> struct mystruct {
>   void *const mymember;
> };
>
> This can of course be already achieved using SIP directives and CPython
> calls, but it would be nice if there was a clearer, shorter way of doing
> it.
>
> I'm fairly new to SIP so there might be some point I've missed; if so,
> please feel free to point it out.

I'll add them to the TODO list.

Phil


More information about the PyQt mailing list