[PyKDE] SIP 3.10 problems

Claus, Richard claus at SLAC.Stanford.EDU
Fri Feb 27 20:16:01 GMT 2004


Windows:
Microsoft Development Environment 2003, version 7.1.3088
Microsoft Visual C++ .NET   69462-270-0000007-18739  

C:\test>sip -V
3.10 (3.10-171)

Excerpted from my code:
OSWtimeContribution.h:
class DLL_EXPORT_API OSWtimeContribution
{
public:
  OSWtimeContribution()  {}
  ~OSWtimeContribution() {}

  void timebase(unsigned* tb) const { tb[0] = _timebase[1];
                                      tb[1] = _timebase[0]; }

private:
  unsigned _timebase[2];
};

OSWtimeContribution.sip version 1:
%ModuleHeaderCode
#include "OSWtimeContribution.h"
%End


class OSWtimeContribution
{
public:
  OSWtimeContribution();
  ~OSWtimeContribution();

  void timebase(unsigned* /*tb*/)  const;
%MemberCode
    OSWtimeContribution* sipCpp;
    unsigned*            a0;

    if (sipParseArgs(&sipArgsParsed,sipArgs,"mi", sipThisObj,sipClass_OSWtimeContribution,&sipCpp, &a0))
    {
      Py_BEGIN_ALLOW_THREADS
      sipCpp -> timebase(a0);
      Py_END_ALLOW_THREADS
    }
%End
};

sip -w gives:
sip: Warning: ../sip/OSWtimeContribution.sip:23: %MemberCode is deprecated, please use %MethodCode instead

Changing %MemberCode to %MethodCode gives a crash:
The instruction at "0x00404d64" refrenced memory at "0x00000000".  The memory could not be "read".

Following a suggestion from Jim Bublitz, I think the following should work:
OSWtimeContribution.sip version 2:
%ModuleHeaderCode
#include "OSWtimeContribution.h"
%End


class OSWtimeContribution
{
public:
  OSWtimeContribution();
  ~OSWtimeContribution();

  void timebase(unsigned* /Out/)  const;
};

This gives the same crash at 0x00404d64.

Changing /Out/ to /In/ above allows "successful" compilation, but seems wrong.  Does the Out/In qualifier refer to the pointer or what it points to?  

Also, in the full project I get lots of the following from sip generated code during "successful" compilation:
c:\online\ebf\vs.net2003\sipebftkrcontribution.cpp(71) : warning C4700: local variable 'sipRes' used without having been initialized

c:\online\ebf\vs.net2003\sipebfaemheader.cpp(64) : warning C4700: local variable 'a0' used without having been initialized

c:\online\ebf\sipebflatcontributioniterator.cpp(68) : warning C4715: 'sipLATcontributionIterator::EBF' : not all control paths return a value

	Thanks,
		Ric




More information about the PyQt mailing list