Avoid forced linking to debug python library in windows #1570

wl2776 opened this Issue Dec 30, 2016 · 0 comments


None yet

1 participant

wl2776 commented Dec 30, 2016

File pyconfig.h shipped with Python distributions (Anaconda python2, CPython 2.7), forces linking to debug python library in windows with compiler pragmas:

Here is the relevant part of that file.

/* For an MSVC DLL, we can nominate the .lib files used by extensions */
#       ifndef Py_BUILD_CORE /* not building the core - must be an ext */
#               if defined(_MSC_VER)
                        /* So MSVC users need not specify the .lib file in
                        their Makefile (other compilers are generally
                        taken care of by distutils.) */
#                       ifdef _DEBUG
#                               pragma comment(lib,"python27_d.lib")
#                       else
#                               pragma comment(lib,"python27.lib")
#                       endif /* _DEBUG */
#               endif /* _MSC_VER */
#       endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */

This python library is usually missing, and such debugging is not always needed.

Boost.Python provides a wrapper around Python.h, #undef-ining _DEBUG macro before inclusion of this file.

Source file, generated by Cython, simply includes Python.h

I suggest adding option that would provide similar function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment