[PyKDE] SIP questions

Jim Bublitz jbublitz at nwinternet.com
Thu May 29 17:51:01 BST 2003


On Thursday May 29 2003 07:08, Jonathan Gardner wrote:
> On Tuesday 25 March 2003 14:05, Jim Bublitz wrote:
> > sip still generates one cpp/h file pair per class, but how
> > you distribute classes over sip files makes no difference to
> > anything. Every class needs a %HeaderCode block though, no
> > matter how you arrange things.

> I hate to disagree with you, Jim, and I know I am probably the
> one who is wrong here, but I've found that at least for 3.5,
> this isn't true. Here is what I have in my sip file for
> PostgeSQL:

> %HeaderCode
> #include "libpq-fe++.h" // My C++ wrapper around libpq-fe.h
> %End

> class result {
 	...
> };
>
> class Conn {
> 	...
> };

> Everything seems to work okay, even though I only have one
> %HeaderCode block and it is outside the classes.

> Correct me if I am wrong.

I'll take your word that it works. It may be that sip has changed 
and I'm not aware of it (although I don't think so). It's more 
likely that the dependencies are getting satisfied via some 
feature of the Makefile or sequence of compilation. For example, 
if PyKDE is built using the -c switch to build.py, that doesn't 
guarantee it will build *without* the -c switch, because the way 
the h files are pulled in is different in each case.  Similarly, 
if your wrapper h file pulls in all of the other necessary h 
files and in turn the wrapper h file is pulled in by another 
file common to all the cpp files, you won't see a need for a 
header code block in each class. However, generally I believe 
that's still a requirement - it seems to me to be the difference 
between "works sometimes" and "always works".

In general, I still get the best results by adding a %HeaderCode 
block to each class.

Jim




More information about the PyQt mailing list