Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename PY_NO_LINK_LIB to Py_NO_LINK_LIB
  • Loading branch information
arhadthedev authored and jcfr committed Mar 2, 2025
commit 3658f4c58ec268428dd00d1bd834df4192766a51
8 changes: 4 additions & 4 deletions Doc/extending/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ gives you access to spam's names, but does not create a separate copy. On Unix,
linking with a library is more like ``from spam import *``; it does create a
separate copy.

.. c:macro:: PY_NO_LINK_LIB
.. c:macro:: Py_NO_LINK_LIB

Turn off the implicit, ``#pragma``-based linkage with the Python
library, performed inside CPython header files.
Expand Down Expand Up @@ -138,14 +138,14 @@ When creating DLLs in Windows, you can use the CPython library in two ways::
:file:`.lib`), which knows how to find the necessary functions from spam,
and also from the Python executable.

2. Manually by defining :c:macro:`PY_NO_LINK_LIB` macro before including
2. Manually by defining :c:macro:`Py_NO_LINK_LIB` macro before including
:file:`Python.h`. You must pass :file:`pythonXY.lib` to the linker.

To build two DLLs, spam and ni (which uses C functions found in spam), you
could use these commands::

cl /LD /DPY_NO_LINK_LIB /I/python/include spam.c ../libs/pythonXY.lib
cl /LD /DPY_NO_LINK_LIB /I/python/include ni.c spam.lib ../libs/pythonXY.lib
cl /LD /DPy_NO_LINK_LIB /I/python/include spam.c ../libs/pythonXY.lib
cl /LD /DPy_NO_LINK_LIB /I/python/include ni.c spam.lib ../libs/pythonXY.lib

The first command created three files: :file:`spam.obj`, :file:`spam.dll`
and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
``#pragma``-based linking with ``python3*.lib`` can now be switched off with
:c:expr:`PY_NO_LINK_LIB`. Patch by Jean-Christophe Fillion-Robin.
:c:expr:`Py_NO_LINK_LIB`. Patch by Jean-Christophe Fillion-Robin.
6 changes: 3 additions & 3 deletions PC/pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
#ifdef MS_COREDLL
# if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
/* not building the core - must be an ext */
# if defined(_MSC_VER) && !defined(PY_NO_LINK_LIB)
# if defined(_MSC_VER) && !defined(Py_NO_LINK_LIB)
/* So MSVC users need not specify the .lib
file in their Makefile */
/* Define PY_NO_LINK_LIB to build extension disabling pragma
/* Define Py_NO_LINK_LIB to build extension disabling pragma
based auto-linking.
This is relevant when using build-system generator (e.g CMake) where
the linking is explicitly handled */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment isn't important for this file, though a short header above the entire block (something like "automatically reference python3x.lib") might make it easier to understand the purpose without reading the whole way through.

Expand All @@ -335,7 +335,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
# pragma comment(lib,"python314.lib")
# endif /* _DEBUG */
# endif /* Py_GIL_DISABLED */
# endif /* _MSC_VER && !PY_NO_LINK_LIB */
# endif /* _MSC_VER && !Py_NO_LINK_LIB */
# endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */

Expand Down