Wrapping long doubles in python
Ayman Habib <[email protected]> Thu, 30 Jan 2025 14:32:15 -0800
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CAFkhwKvpHU_-mEcH+k_huHsOOWdAG4NTFfbvcfWK8Wn4DCLzAg@mail.gmail.com> |
--===============4862819793521827964== Content-Type: multipart/alternative; boundary="0000000000001f33e7062cf4009d" --0000000000001f33e7062cf4009d Content-Type: text/plain; charset="UTF-8" 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 --0000000000001f33e7062cf4009d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hello,<br><br>I'm upgrading the swig version we use fr= om 4.1.1 to 4.2 and running into a problem because of the macro below (it a= ppears 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:<br><br>#def= ine MY_PI 3.1415926535897L<br><br>The resulting python code doesn't com= pile:<br><br>=C2=A0 SWIG_Python_SetConstant(d, "MY_PI",SWIG_NewPo= interObj(SWIG_as_voidptr(&3.1415926535897),SWIGTYPE_p_long_double, 0 ))= ;<div><br></div><div>The compilation error follows:=C2=A0<br><br>'&= ' on constant (C2101 in visual studio).<br><br>Any suggestions for work= ing around this issue?</div><div><br></div><div>Thanks,</div><div>-Ayman</d= iv></div> --0000000000001f33e7062cf4009d-- --===============4862819793521827964== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============4862819793521827964== 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 --===============4862819793521827964==--