On Sat, Nov 13, 2021 at 3:28 AM Marco Sulla <marco.sulla.pyt...@gmail.com> wrote: > > On Fri, 12 Nov 2021 at 15:55, Gisle Vanem <gisle.va...@gmail.com> wrote: > > Marco Sulla wrote: > > > Error LNK2001: unresolved external symbol PyErr_SetObject > > > > > > and so on. > > > > > > I post the part of my setup.py about the C Extension: > > > > > > extra_compile_args = ["-DPY_SSIZE_T_CLEAN", "-DPy_BUILD_CORE"] > > > > Shouldn't this be "-DPy_BUILD_CORE_MODULE"? > > I tried it, but now I get three > > error C2099: initializer is not a constant > > when I try to compile dictobject.c. Yes, my extension needs dictobject.
Are you sure that you really need Py_BUILD_CORE? Here's what the code has to say about it: https://github.com/python/cpython/blob/main/Include/pyport.h#L17 Py_BUILD_CORE: Build Python core. Give access to Python internals, but should not be used by third-party modules. If your extension truly needs to reach into the internals of CPython, then you're going to have to figure a lot of things out for yourself, including how to make sure it works on every platform. A more productive approach would be to stick to the actual API: https://docs.python.org/3/c-api/stable.html What is it that doesn't work without Py_BUILD_CORE? ChrisA -- https://mail.python.org/mailman/listinfo/python-list