Re: Wrapping long doubles in python
Ayman Habib <[email protected]> Mon, 3 Feb 2025 14:13:05 -0800
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CAFkhwKv424wKCP9DWiJWdK+em2NnkF9oCn_wpN8xzuAoJX_xWQ@mail.gmail.com> |
--===============7965146517255707935== Content-Type: multipart/alternative; boundary="0000000000000b9f0c062d443376" --0000000000000b9f0c062d443376 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks John, I tried 4.3.0 and had the exact same problem, I'm using python 3.9 on windows with visual studio 2022 Community Edition. Trying python 3.12 produced the same errors (and a few more that I didn't get to investigate); Thanks again for your help and hope that helps track down the issue, -Ayman On Mon, Feb 3, 2025 at 8:22=E2=80=AFAM John Wyatt <[email protected]> wrote= : > 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]> = wrote: > >> 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_= long_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 >> > --0000000000000b9f0c062d443376 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Thanks John,=C2=A0<div><br></div><div>I tried 4.3.0 and ha= d the exact same problem, I'm using python 3.9 on windows with visual s= tudio=C2=A02022 Community Edition.=C2=A0</div><div>Trying python 3.12 produ= ced the same errors (and a few more that I didn't get to investigate);<= /div><div><br></div><div>Thanks again for your help and hope that helps tra= ck down the issue,</div><div>-Ayman</div><div><br></div></div><br><div clas= s=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_att= r">On Mon, Feb 3, 2025 at 8:22=E2=80=AFAM John Wyatt <<a href=3D"mailto:= [email protected]">[email protected]</a>> wrote:<br></div><blockquote cl= ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid= rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div>Hello Ayman,</div= ><div><br></div><div>You did not include important info, such as your platf= orm (Windows or Mac?), Python and Visual 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" target=3D"_blank">https://github.com/swig/swig.git</a> = to see if the issue is on the latest version?<br></div></div><br><div class= =3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Jan 30, 2025= at 5:34=E2=80=AFPM Ayman Habib <<a href=3D"mailto:[email protected]" t= arget=3D"_blank">[email protected]</a>> wrote:<br></div><blockquote cla= ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid = rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Hello,<br><br>I'm u= pgrading the swig version we use from 4.1.1 to 4.2 and running into a probl= em because of the macro below (it appears in a header file from a third par= ty library that I can't change), but I get the same behavior inserting = the line in my .i file:<br><br>#define MY_PI 3.1415926535897L<br><br>The re= sulting python code doesn't compile:<br><br>=C2=A0 SWIG_Python_SetConst= ant(d, "MY_PI",SWIG_NewPointerObj(SWIG_as_voidptr(&3.14159265= 35897),SWIGTYPE_p_long_double, 0 ));<div><br></div><div>The compilation err= or follows:=C2=A0<br><br>'&' on constant (C2101 in visual studi= o).<br><br>Any suggestions for working around this issue?</div><div><br></d= iv><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> </blockquote></div> --0000000000000b9f0c062d443376-- --===============7965146517255707935== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============7965146517255707935== 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 --===============7965146517255707935==--