Re: Python stable ABI under Windows

William S Fulton <[email protected]> Wed, 22 May 2024 07:48:44 +0100
Newsgroups gmane.comp.programming.swig
Message-ID <CANGqftA_RBi8QKWxfTmDXfxjc6xpfwWRV9A5O9sHbGBm_4qb_Q@mail.gmail.com>
--===============5995051905826563760==
Content-Type: multipart/alternative; boundary="0000000000008428ce0619055565"

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

Probably worth looking closely at the Python docs on the stable ABI at
https://docs.python.org/3/c-api/stable.html. It does say to not link
against the versioned dll on Windows.

William

On Tue, 21 May 2024 at 21:40, Ren=C3=A9 Glockan <[email protected]> wro=
te:

> Hello,
>
> I'm currently trying to get the python stable ABI to work in our project.
> According to the documentation I only have to add
> `target_compile_definitions(_${PYTHON_WRAPPER_NAME} PUBLIC
> Py_LIMITED_API=3D0x03040000)`
> to my existing CMake project. Under my ubuntu 20.04 test system this work=
ed
> and I could use any other Python version.
> But under Windows (10) I'm still limited to the python version I used to
> build it.
> If I use any other python version I get the following error:
> `ImportError: DLL load failed while importing _Pyswig_test: The specified
> module could not be found.`
> _Pyswig_test being the name of my test project. Everything is in the same
> directory.
> It did change something during compilation as it now links against
> python.lib instead of the previous python38.lib.
> Do I have to do something special to make the stable ABI work under
> Windows?
>
> With best regards
> Ren=C3=A9 Glockan
>
> _______________________________________________
> Swig-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/swig-user
>

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

<div dir=3D"ltr"><div>Probably worth looking closely at the Python docs on =
the stable ABI at <a href=3D"https://docs.python.org/3/c-api/stable.html">h=
ttps://docs.python.org/3/c-api/stable.html</a>. It does say to not link aga=
inst the versioned dll on Windows.</div><div><br></div><div>William<br></di=
v></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr=
">On Tue, 21 May 2024 at 21:40, Ren=C3=A9 Glockan &lt;<a href=3D"mailto:ren=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquo=
te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px =
solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
I&#39;m currently trying to get the python stable ABI to work in our projec=
t.<br>
According to the documentation I only have to add <br>
`target_compile_definitions(_${PYTHON_WRAPPER_NAME} PUBLIC<br>
Py_LIMITED_API=3D0x03040000)`<br>
to my existing CMake project. Under my ubuntu 20.04 test system this worked=
<br>
and I could use any other Python version.<br>
But under Windows (10) I&#39;m still limited to the python version I used t=
o<br>
build it.<br>
If I use any other python version I get the following error:<br>
`ImportError: DLL load failed while importing _Pyswig_test: The specified<b=
r>
module could not be found.`<br>
_Pyswig_test being the name of my test project. Everything is in the same<b=
r>
directory.<br>
It did change something during compilation as it now links against<br>
python.lib instead of the previous python38.lib.<br>
Do I have to do something special to make the stable ABI work under Windows=
?<br>
<br>
With best regards<br>
Ren=C3=A9 Glockan<br>
<br>
_______________________________________________<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>

--0000000000008428ce0619055565--


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


--===============5995051905826563760==
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

--===============5995051905826563760==--