[PyQt] SIP Bug: virtual function wrapped twice due to deep inheritance from base class and ABC
Demetrius Cassidy
dcassidy36 at mass.rr.com
Sat Jun 19 18:27:55 BST 2010
Basically I have a Listen() function in a derived class, that is also in the
base and ABC. For some reason sip ends up wrapping the same function twice
(it
has a body in the ABC), even though it's a virtual function in all of the
derived classes. If I comment out this function in the ABC, everything works
fine, but otherwise I get a C2535 compiler error with Visual C++.
Here is what sip comes up with:
class sipPUDPSocket : public PUDPSocket
{
/*
* There is a protected method for every virtual method visible from
* this class.
*/
protected:
PBoolean Listen(unsigned,WORD,PIPSocket::Reusability);
/*more wrapped functions*/
PBoolean Listen(unsigned,WORD,PIPSocket::Reusability); // <-- duplicate
function
};
C++ nmake errors:
sippyptlibPTCPSocket.cpp
.\sippyptlibPTCPSocket.cpp(121) : error C2535: 'PBoolean
sipPTCPSocket::Listen(unsigned int,WORD,PSocket::Reusability)'
: member function already defined or declared
.\sippyptlibPTCPSocket.cpp(102) : see declaration of
'sipPTCPSocket::Listen'
.\sippyptlibPTCPSocket.cpp(506) : error C2084: function 'PBoolean
sipPTCPSocket:
:Listen(unsigned int,WORD,PSocket::Reusability)' already has a body
.\sippyptlibPTCPSocket.cpp(102) : see previous definition of
'Listen'
Basic code structure based on what I am wrapping - note that I only included
the
offending function here, as it would be too much code to include everything.
typedef bool PBoolean;
class PTCPSocket : PIPDataGramSocket
{
public:
virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability);
}
class PIPDataGramSocket : PIPSocket
{
protected:
PIPDataGramSocket();
}
class PIPSocket : PSocket
{
public:
virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability);
}
class PSocket /Abstract/
{
public:
/// Flags to reuse of port numbers in Listen() function.
enum Reusability {
CanReuseAddress,
AddressIsExclusive
};
virtual PBoolean Listen(unsigned int, WORD, PSocket::Reusability); //
commenting this function out fixes this problem
protected:
/*This function calls os_socket() with the correct parameters for the
socket protocol type.
*/
virtual PBoolean OpenSocket() = 0;
};
--
Regards,
-Demetrius Cassidy
--
View this message in context: http://old.nabble.com/SIP-Bug%3A-virtual-function-wrapped-twice-due-to-deep-inheritance-from-base-class-and-ABC-tp28936011p28936011.html
Sent from the PyQt mailing list archive at Nabble.com.
More information about the PyQt
mailing list