Skip to content

Conversation

@fredroy
Copy link
Contributor

@fredroy fredroy commented Sep 9, 2021

"Hack" to force to link with the release version of python3x.lib
The link command is contained deep in python (pyconfig.h):

/* For an MSVC DLL, we can nominate the .lib files used by extensions */
#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)
                        /* So MSVC users need not specify the .lib
                        file in their Makefile (other compilers are
                        generally taken care of by distutils.) */
#                       if defined(_DEBUG)
#                               pragma comment(lib,"python39_d.lib")
#                       elif defined(Py_LIMITED_API)
#                               pragma comment(lib,"python3.lib")
#                       else
#                               pragma comment(lib,"python39.lib")
#                       endif /* _DEBUG */
#               endif /* _MSC_VER */
#       endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */

So according to various sources, the "best" way is to disable debug before including python.h
https://bugs.python.org/issue22411

@hugtalbot
Copy link
Contributor

@epernod and @Camille-K do not hesitate to let us know if you tested it !

Co-authored-by: Guillaume Paran <guillaume.paran@sofa-framework.org>
@alxbilger alxbilger merged commit 204aac4 into sofa-framework:master Sep 24, 2021
guparan added a commit to guparan/SofaPython3 that referenced this pull request Oct 1, 2021
* fix compilation in debug mode with msvc

* Update Plugin/src/SofaPython3/PythonEnvironment.h

Co-authored-by: Guillaume Paran <guillaume.paran@sofa-framework.org>

Co-authored-by: Guillaume Paran <guillaume.paran@sofa-framework.org>
@guparan guparan added this to the v21.12 milestone Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants