Mmmm, ok...but your solution is not praticable in the script that I'm writing. I'm writing a script that generate python classes from C structures(and relative methods that use those structures), so, when I parse a method in a C header, I need to know if a pointer argument points to a single integer or to a vector to wrap the method. I think it's impossible to do this in the script. Am I wrong?<br>
<br><div><span class="gmail_quote">2008/4/10, Lenard Lindstrom <<a href="mailto:len-l@telus.net">len-l@telus.net</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
One way is to create a new Python container type that wraps the C int<br> array. The other is to copy values between the int array and some<br> existing Python container type, such as a list.<br> <br> Lenard<br> <br><br> <br>
Daniele Pianu wrote:<br> > And if the c pointer points to a vector of numeric values and not a<br> > single int? Is there any way to manage that in pyrex?<br> ><br> <br>> 2008/4/9, Lenard Lindstrom <<a href="mailto:len-l@telus.net">len-l@telus.net</a> <mailto:<a href="mailto:len-l@telus.net">len-l@telus.net</a>>>:<br>
<br>><br> > Daniele Pianu wrote:<br> > > I've a C function like this<br> > ><br> > > void Socket_getRemoteAddr(Socket *self, char *serverHostAddr,<br> > int bufferSize, int *serverPortNo)<br>
> ><br> > > and I want to wrap it on this python method<br> > ><br> > > def setRemoteAddr( self, serverHostAddr, serverPortNo )<br> > ><br> > > serverPortNo is a python integer, and it must reflect modifications<br>
> > done on the relative C argument (serverPortNo). How can I do it<br> > in pyrex?<br> > ><br> ><br> > The usual way is to return the changed value as a value of the<br> > function:<br>
><br> > def setRemoteAddr(...., int serverPortNo):<br> > ....<br> > Socket_getRemoteAddr(...., &serverPortNo)<br> > ....<br> > return serverPortNo<br> ><br> <br>
<br> <br>_______________________________________________<br> Pyrex mailing list<br> <a href="mailto:Pyrex@lists.copyleft.no">Pyrex@lists.copyleft.no</a><br> <a href="http://lists.copyleft.no/mailman/listinfo/pyrex">http://lists.copyleft.no/mailman/listinfo/pyrex</a><br>
</blockquote></div><br>