<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
<br><br>> Date: Thu, 9 Dec 2010 22:33:26 +0000<br>> From: phil@riverbankcomputing.com<br>> To: gnatty7@hotmail.com<br>> CC: pyqt@riverbankcomputing.com<br>> Subject: Re: [PyQt] Getting around Circualr references in SIP modules<br>> <br>> On Thu, 9 Dec 2010 14:17:31 -0800, Nate Reid <gnatty7@hotmail.com> wrote:<br>> > I am wrapping a set of components that are generally independent of each<br>> > other, but not always.<br>> > <br>> > For example, I have<br>> > ///////<br>> > // foo module<br>> > %Module foo<br>> > %Import common.sip // Need to get a Blah<br>> > %Include SomeClass.sip<br>> > <br>> > Blah* getTheBlah();<br>> > %MethodCode<br>> >     sipRes = ...<br>> > %End<br>> > <br>> > ///////<br>> > // SomeClass.sip<br>> > class SomeClass<br>> > {<br>> > %TypeHeaderCode<br>> > ...<br>> >     <br>> > };<br>> > <br>> > ///////<br>> > // common.sip<br>> > %Module common<br>> > %Import foo // Need SomeClass<br>> > class Blah{<br>> > ...<br>> >     SomeClass* getVal();<br>> > };<br>> > <br>> > <br>> > So, common and foo are different modules but they use classes from each<br>> > other's modules.  How do I get around this problem?  Is there something<br>> I<br>> > can do with ConsolidatedModule, or what not to still et these modules be<br>> > build and installed independently but get around this circular reference<br>> /<br>> > Import issue?<br>> <br>> They probably all need to be part of the same module, but you could try<br>> playing with the /External/ class annotation.<br>> <br>> Phil<br><br>However, namespaces seem to make things difficult:<br><br>////////////////////////////<br>// SomeClass.sip<br>namespace myns {<br>class 
SomeClass<br>{<br>%TypeHeaderCode<br>#include <path/to/myns/SomeClass.h><br>...<br>};<br>};<br><br>///////<br>// common.sip<br>%Module common<br>%Import foo // Need SomeClass<br>namespace myns {<br>    class SomeClass /External/;<br>};<br><br>class Blah{<br> ...<br>myns::SomeClass* getVal();<br>};<br><br>I get a SIP  error:<br>sip: /path/to/common.sip:#  External classes/structs can only be declared in the global scope<br><br><br>So, when I change common.sip to:<br> class myns::SomeClass /External/;<br><br>I get:<br>sip: /path/to/common.sip:# The struct/class has already been defined<br><br>Still possible to use External?<br><br>-Nate<br>
<br>                                        </body>
</html>