windows and python27.lib
When linking to a dll with MSVC, one needs to provide not the dll itself rather an import library. Also, the linker must be able to resolve all function definitions in order to run to completion, so the linker must be able to find the import library. On cpython, the import library used to link to python27.dll is called Python27.lib, it is located in a 'libs' directory at the top level in a cpython distribution together with things like pyexpat.lib, _socket.lib etc. distutils (and setuptools) do not need to know about the import library, since a #pragma is used to issue a link directive for the import library whenever pyconfig.h is included in a c file. A debug build will create and use python27_d.lib that corresponds to python27_d.dll What do we do in PyPy? At translation we build a libpypy-c.dll, and an export library libpypy-c.lib. These are copied together with pypy-c.exe to the directory where translation occurred (on the build bots this is in pypy/goal) Then the package script copies the libpypy-c.lib to pypy's include directory as python27.lib. A debug build will use these same names. The same pragma is used as in cpython to force linking with the import library whenever pyconfig.h is included So what you ask? I think the exe should be created as pypy.exe, the dll should be called pypy27.dll, and the import library should be consistently named pypy27.lib. There should be no renaming in package.py. This has implications in the following places: - the exe_name in targetpypystandalone should drop the -%(backend) modifier - pyconfig.h and the package script should be modified to use pypy27 consistently - probably some tests will fail, they should be fixed - cffi/api.py needs tweaking in _apply_embedding_fix - package.py should not rename (what do we do on linux about pypy-c -> pypy?) what did I forget? We should also handle a debug build of pypy, we should be creating a pypy27_d.lib, pypy27_d.dll, today the usual names are reused. Are there compelling reasons _not_ to make the naming consistent with cpython? As a fallback, we could just rename the import library to pypy27.lib My current motivation to do this is that _apply_embedding_fix does not work for win32 pypy Matti
participants (1)
-
Matti Picus