Re: numeric C pointer argument and python integer argument

"Daniele Pianu" <[email protected]>
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
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?

2008/4/10, Lenard Lindstrom <[email protected]>:
>
> One way is to create a new Python container type that wraps the C int
> array. The other is to copy values between the int array and some
> existing Python container type, such as a list.
>
> Lenard
>
>
>
> Daniele Pianu wrote:
> > And if the c pointer points to a vector of numeric values and not a
> > single int? Is there any way to manage that in pyrex?
> >
>
> > 2008/4/9, Lenard Lindstrom <[email protected] <mailto:[email protected]>>:
>
> >
> >     Daniele Pianu wrote:
> >     > I've a C function like this
> >     >
> >     > void Socket_getRemoteAddr(Socket *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
> >
>
>
>
> _______________________________________________
> Pyrex mailing list
> [email protected]
> http://lists.copyleft.no/mailman/listinfo/pyrex
>

_______________________________________________
Pyrex mailing list
[email protected]
http://lists.copyleft.no/mailman/listinfo/pyrex
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.