[PyKDE] [PyKDE]Re:[sip] newbie questions

Jim Bublitz jbublitz at nwinternet.com
Wed May 15 22:19:01 BST 2002


On 15-May-02 "John J. Lee" <jjl at pobox.com> wrote:
> I've got as far as getting a window to appear, with an immediate
> segfault if you resize it.  However, a few problems with sip:
 
> 1. sip (3.0) seems not to like a few standard C++ declarations
> that I haven't seen mentioned as being problematic: *const and
> virtual destructors.  In the case of the destructors, I've just
> removed the 'virtual', and haven't run into any trouble
> resulting from this yet;

> OTOH, if I remove the const from a *const return type, so that
> sip is happy with it, it conflicts with the library declarations
> and the generated code won't compile.  Is there a way to work
> around this?

I've had one problem with 'const', but that was in a passed
argument, not a return type. In that case, I had to modify the
sip-generated cpp file. The problem was actually with the Python C
library function used (needed a cast in the cpp code that sip
wouldn't provide). It would help if you could post or send me the
function from the h file, sip file, and if you can find it the
code sip generates for it. While it isn't the most attractive
solution, you can always use 'sed' or a Python script to fix up the
generated code if the problem only occurs in one or two places.

You should probably switch to a newer sip version (especially if
you have any global functions or namespace stuff). I'm not aware of
any fixes for anything const related in the later versions, but
there may be some differences.

As far as the destructors, unless they're protected or private you
can delete them completely.
 
> 2. Every time I make an small change to a sip file, make
> recompiles everything, because sip regenerates all code whether
> it changes or not.  Is there a way to prevent this, and if not,
> how has Jim Bublitz managed to retain his sanity whilst wrapping
> KDE? ;)

Your last sentence makes a big assumption that may in fact be
unfounded :) If you're using the PyQt or PyKDE Makefiles (not sure
from your post exactly what you're building) or something set up
similarly, you can make individual targets/modules (this is with the
Makefile that uses sip to generate cpp files - from the CVS or
PyKDE-generic). So for example, if all you want sip to re-generate
is the 'kdecore' module, you can do 'make kdecore' (you need to
delete the 'kdecore' subdirectory first or re-write the Makefile to
to accomplish that).  A 'make' on the cpp files then will only
re-compile the newly generated module but not the unmodified
modules. On the last and next PyKDE releases, you can do 'build
-m <module>' and it takes care of most of the details (in fact on
the next release, the build procedure is quite different).

On a single module basis, sip will re-generate everything. That's
because sip builds a single symbol table for the entire module
before generating any code. Although not entirely a correct view,
I view it as somewhat similar to having to build all of the ojbect
files before linking a program.

Jim




More information about the PyQt mailing list