Re: numeric C pointer argument and python integer argument

Lenard Lindstrom <[email protected]>
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
Daniele Pianu wrote:
> I've a C function like this
>
> void Socket_getRemoteAddr 
> <file:///home/daniele/.HRI/Proxy/HRI/Libraries/Socket/2.0/doc/html/Socket_8h.html#74523edd41cdf2247e109cc58429ca30> 
> (Socket 
> <file:///home/daniele/.HRI/Proxy/HRI/Libraries/Socket/2.0/doc/html/structSocket.html> 
> *self, char *serverHostAddr, int bufferSize, int *serverPortNo)
>
> and I want to wrap it on this python method
>
> def setRemoteAddr( self, serverHostAddr, serverPortNo )
>
> serverPortNo is a python integer, and it must reflect modifications 
> done on the relative C argument (serverPortNo). How can I do it in pyrex?
>
The usual way is to return the changed value as a value of the function:

def setRemoteAddr(...., int serverPortNo):
    ....
    Socket_getRemoteAddr(...., &serverPortNo)
    ....
    return serverPortNo

-- 
Lenard Lindstrom
<[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.