带有 python 扩展名的 VS2015 链接器错误

VS2015 linker error with python extension

我正在尝试构建我自己的 python (3.5.2) 依赖于 zlib 的 c 扩展。在 linux 上使用 gcc,它工作得很好,但我似乎无法让它在 windows 64 位上工作。

我按照说明安装了zlib dll:

Installing ZLIB1.DLL
====================
  Copy ZLIB1.DLL to the SYSTEM or the SYSTEM32 directory.


Using ZLIB1.DLL with Microsoft Visual C++
=========================================
   1. Install the supplied header files "zlib.h" and "zconf.h"
      into a directory found in the INCLUDE path list.

   2. Install the supplied library file "zdll.lib" into a
      directory found in the LIB path list.

   3. Add "zdll.lib" to your project.

我的setup.py:

from setuptools import setup, Extension
from Cython.Build import cythonize

setup(
    ext_modules=cythonize([Extension("esp", ["bethlib/esp.pyx", "bethlib/c_esp.c", "bethlib/linked_list.c"], libraries=["zdll"], include_dirs=["include"], library_dirs=["lib"])]),
)

尝试使用 python setup.py bdist_wheel 构建时出现错误:

c_esp.obj : error LNK2001: unresolved external symbol uncompress
build\lib.win-amd64-3.5\esp.cp35-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals
error: command 'E:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe' failed with exit status 1120

uncompress 是 zlib.h 中存在的有效函数。任何解决方案?谢谢!

我从 this website 下载了静态 zlib 库,它可以工作。它适用于旧版本,所以如果我能获得更新的版本,我仍然会很感激,但现在已经足够了。