Re: Pointers

Javier Correa <[email protected]> Tue, 9 Nov 2010 18:05:06 +0000
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
--===============0294255117==
Content-Type: multipart/alternative; boundary=20cf3054a555aa8b600494a2946b

--20cf3054a555aa8b600494a2946b
Content-Type: text/plain; charset=UTF-8

sorry, my problem, I wasn't seeing a typo.

On Tue, Nov 9, 2010 at 6:03 PM, Javier Correa <[email protected]>wrote:

> Defining:
>    ctypedef struct _CMesaDevice
>    ctypedef _CMesaDevice * SRCAM
>
> got rid of some problems, sorry I wasn't getting how to use the incomplet
> types.
>
> I still have a problem with the void* return type:
>  Cannot convert 'void *' to Python object
> when I try to do:
> ...
>       cdef void * images
> ...
>       image = SR_GetImage(self.cam, 0)
>
>
> On Tue, Nov 9, 2010 at 5:56 PM, Javier Correa <[email protected]>wrote:
>
>> The C typedef is:
>>
>> typedef struct _CMesaDevice *SRCAM;
>>
>> and I don't have access to _CMesaDevice declaration.
>>
>> I was trying to use an incomplete type as in
>> http://ldots.org/pyrex-guide/4-functions.html#incomplete_types
>>
>>
>> On Tue, Nov 9, 2010 at 5:39 PM, Stefan Behnel <[email protected]>wrote:
>>
>>> Javier Correa, 09.11.2010 18:16:
>>>
>>>  I-m new to pyrex and I'm trying to use it to have access to a library
>>>> (MesaSR, http://www.mesa-imaging.ch/drivers.php), but I can't make use
>>>> of
>>>> pointers.
>>>>
>>>> I can't seem to define a function that one of its arguments it's a
>>>> pointer
>>>> (a function that initialize the structure). I'm also having troubles
>>>> with
>>>> using the SR_GetImage that returns a void* pointer.
>>>>
>>>> My code is as follows:
>>>>
>>>> import numpy
>>>>
>>>> cdef extern from "libMesaSR.h":
>>>>    ctypedef SRCAM
>>>>
>>>
>>> ctypedef SCRAM *what*?
>>>
>>> Stefan
>>>
>>
>>
>>
>> --
>> Javier Correa
>>
>> Por favor, no imprimas este e-mail si realmente no lo necesitas...
>> Conservar el medio ambiente es nuestra tarea...
>> Please, don't print this e-mail if it's not needed... preserve the
>> environment is our task...
>>
>>
>
>
> --
> Javier Correa
>
> Por favor, no imprimas este e-mail si realmente no lo necesitas...
> Conservar el medio ambiente es nuestra tarea...
> Please, don't print this e-mail if it's not needed... preserve the
> environment is our task...
>
>


-- 
Javier Correa

Por favor, no imprimas este e-mail si realmente no lo necesitas... Conservar
el medio ambiente es nuestra tarea...
Please, don't print this e-mail if it's not needed... preserve the
environment is our task...

--20cf3054a555aa8b600494a2946b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

sorry, my problem, I wasn&#39;t seeing a typo.<br><br><div class=3D"gmail_q=
uote">On Tue, Nov 9, 2010 at 6:03 PM, Javier Correa <span dir=3D"ltr">&lt;<=
a href=3D"mailto:[email protected]">[email protected]</a>&gt;</=
span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex;">Defining:<div><div>=C2=A0=C2=A0 ctypedef st=
ruct _CMesaDevice</div><div>=C2=A0=C2=A0 ctypedef _CMesaDevice * SRCAM</div=
><div><br></div><div>
got rid of some problems, sorry I wasn&#39;t getting how to use the incompl=
et types.</div><div><br></div>
I still have a problem with the void* return type:</div><div class=3D"im"><=
div><div>=C2=A0Cannot convert &#39;void *&#39; to Python object</div></div>=
</div><div>when I try to do:</div><div>...</div><div><div>=C2=A0=C2=A0 =C2=
=A0 =C2=A0cdef void * images</div>
<div>...</div><div class=3D"im">
<div>=C2=A0=C2=A0 =C2=A0 =C2=A0image =3D SR_GetImage(self.cam, 0)</div></di=
v></div><div><div></div><div class=3D"h5"><div><br></div><div><br><div clas=
s=3D"gmail_quote">On Tue, Nov 9, 2010 at 5:56 PM, Javier Correa <span dir=
=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">j=
[email protected]</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">The C typedef is:<div><br></div><div>typedef=
 struct _CMesaDevice *SRCAM;</div><div><br></div><div>and I don&#39;t have =
access to _CMesaDevice declaration.</div>

<div><br></div><div>I was trying to use an incomplete type as in=C2=A0<a hr=
ef=3D"http://ldots.org/pyrex-guide/4-functions.html#incomplete_types" targe=
t=3D"_blank">http://ldots.org/pyrex-guide/4-functions.html#incomplete_types=
</a><div>

<div></div><div><br>
<br><div class=3D"gmail_quote">On Tue, Nov 9, 2010 at 5:39 PM, Stefan Behne=
l <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_b=
lank">[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gma=
il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef=
t:1ex">


Javier Correa, 09.11.2010 18:16:<div><br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
I-m new to pyrex and I&#39;m trying to use it to have access to a library<b=
r>
(MesaSR, <a href=3D"http://www.mesa-imaging.ch/drivers.php" target=3D"_blan=
k">http://www.mesa-imaging.ch/drivers.php</a>), but I can&#39;t make use of=
<br>
pointers.<br>
<br>
I can&#39;t seem to define a function that one of its arguments it&#39;s a =
pointer<br>
(a function that initialize the structure). I&#39;m also having troubles wi=
th<br>
using the SR_GetImage that returns a void* pointer.<br>
<br>
My code is as follows:<br>
<br>
import numpy<br>
<br>
cdef extern from &quot;libMesaSR.h&quot;:<br>
 =C2=A0 =C2=A0ctypedef SRCAM<br>
</blockquote>
<br></div>
ctypedef SCRAM *what*?<br><font color=3D"#888888">
<br>
Stefan<br>
</font></blockquote></div><br><br clear=3D"all"><br></div></div><div>-- <br=
>Javier Correa<br><br>Por favor, no imprimas este e-mail si realmente no lo=
 necesitas... Conservar el medio ambiente es nuestra tarea... <br>
Please, don&#39;t print this e-mail if it&#39;s not needed... preserve the =
environment is our task...<br>
<br>
</div></div>
</blockquote></div><br><br clear=3D"all"><br>-- <br>Javier Correa<br><br>Po=
r favor, no imprimas este e-mail si realmente no lo necesitas... Conservar =
el medio ambiente es nuestra tarea... <br>Please, don&#39;t print this e-ma=
il if it&#39;s not needed... preserve the environment is our task...<br>

<br>
</div>
</div></div></blockquote></div><br><br clear=3D"all"><br>-- <br>Javier Corr=
ea<br><br>Por favor, no imprimas este e-mail si realmente no lo necesitas..=
. Conservar el medio ambiente es nuestra tarea... <br>Please, don&#39;t pri=
nt this e-mail if it&#39;s not needed... preserve the environment is our ta=
sk...<br>
<br>

--20cf3054a555aa8b600494a2946b--


--===============0294255117==
Content-Type: text/plain; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

_______________________________________________
Pyrex mailing list
[email protected]
http://lists.copyleft.no/mailman/listinfo/pyrex

--===============0294255117==--