Re: Wrapping long doubles in python

John Wyatt <[email protected]> Mon, 3 Feb 2025 11:21:59 -0500
Newsgroups gmane.comp.programming.swig
Message-ID <CAEPh5AXVtBn0b40D9UJ2pQRYThvmEMu6xHuD9b_NGtu7DrSaRQ@mail.gmail.com>
--===============4580061126919667201==
Content-Type: multipart/alternative; boundary="000000000000590c65062d3f4bb8"

--000000000000590c65062d3f4bb8
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello Ayman,

You did not include important info, such as your platform (Windows or
Mac?), Python and Visual Studio version.

Would you please try 4.3.0 or the git: https://github.com/swig/swig.git to
see if the issue is on the latest version?

On Thu, Jan 30, 2025 at 5:34=E2=80=AFPM Ayman Habib <[email protected]> wr=
ote:

> Hello,
>
> I'm upgrading the swig version we use from 4.1.1 to 4.2 and running into =
a
> problem because of the macro below (it appears in a header file from a
> third party library that I can't change), but I get the same behavior
> inserting the line in my .i file:
>
> #define MY_PI 3.1415926535897L
>
> The resulting python code doesn't compile:
>
>   SWIG_Python_SetConstant(d,
> "MY_PI",SWIG_NewPointerObj(SWIG_as_voidptr(&3.1415926535897),SWIGTYPE_p_l=
ong_double,
> 0 ));
>
> The compilation error follows:
>
> '&' on constant (C2101 in visual studio).
>
> Any suggestions for working around this issue?
>
> Thanks,
> -Ayman
> _______________________________________________
> Swig-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/swig-user
>

--000000000000590c65062d3f4bb8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello Ayman,</div><div><br></div><div>You did not inc=
lude important info, such as your platform (Windows or Mac?), Python and Vi=
sual Studio version.<br></div><div><br></div><div>Would you please try 4.3.=
0 or the git: <a href=3D"https://github.com/swig/swig.git">https://github.c=
om/swig/swig.git</a> to see if the issue is on the latest version?<br></div=
></div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr=
" class=3D"gmail_attr">On Thu, Jan 30, 2025 at 5:34=E2=80=AFPM Ayman Habib =
&lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:=
<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr=
">Hello,<br><br>I&#39;m upgrading the swig version we use from 4.1.1 to 4.2=
 and running into a problem because of the macro below (it appears in a hea=
der file from a third party library that I can&#39;t change), but I get the=
 same behavior inserting the line in my .i file:<br><br>#define MY_PI 3.141=
5926535897L<br><br>The resulting python code doesn&#39;t compile:<br><br>=
=C2=A0 SWIG_Python_SetConstant(d, &quot;MY_PI&quot;,SWIG_NewPointerObj(SWIG=
_as_voidptr(&amp;3.1415926535897),SWIGTYPE_p_long_double, 0 ));<div><br></d=
iv><div>The compilation error follows:=C2=A0<br><br>&#39;&amp;&#39; on cons=
tant (C2101 in visual studio).<br><br>Any suggestions for working around th=
is issue?</div><div><br></div><div>Thanks,</div><div>-Ayman</div></div>
_______________________________________________<br>
Swig-user mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">Swig-u=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/swig-user" rel=3D"n=
oreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/s=
wig-user</a><br>
</blockquote></div>

--000000000000590c65062d3f4bb8--



--===============4580061126919667201==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============4580061126919667201==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user

--===============4580061126919667201==--