summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/msvccompiler.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-08-02 00:00:30 (GMT)
committerGreg Ward <gward@python.net>2000-08-02 00:00:30 (GMT)
commit159eb92239c20198e9318acbe142ab3e168aae4b (patch)
tree88c58d7227e1022ec6b2eaf196129c6f8b973eaf /Lib/distutils/msvccompiler.py
parent0419a4ffbabce545d9c8ab19d16a087a1c8dd985 (diff)
downloadcpython-159eb92239c20198e9318acbe142ab3e168aae4b.zip
cpython-159eb92239c20198e9318acbe142ab3e168aae4b.tar.gz
cpython-159eb92239c20198e9318acbe142ab3e168aae4b.tar.bz2
Patch from Rene Liebscher: generate an /IMPLIB: option to ensure that
the linker leaves the (temporary) .lib file in the temporary dir. (Moved from 'msvc_prelink_hack()' method in build_ext.py.)
Diffstat (limited to 'Lib/distutils/msvccompiler.py')
-rw-r--r--Lib/distutils/msvccompiler.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py
index e58e6c1..b86e0b3 100644
--- a/Lib/distutils/msvccompiler.py
+++ b/Lib/distutils/msvccompiler.py
@@ -380,10 +380,22 @@ class MSVCCompiler (CCompiler) :
ld_args = (ldflags + lib_opts + export_opts +
objects + ['/OUT:' + output_filename])
+ # The MSVC linker generates .lib and .exp files, which cannot be
+ # suppressed by any linker switches. The .lib files may even be
+ # needed! Make sure they are generated in the temporary build
+ # directory. Since they have different names for debug and release
+ # builds, they can go into the same directory.
+ (dll_name, dll_ext) = os.path.splitext(
+ os.path.basename(output_filename))
+ implib_file = os.path.join(
+ os.path.dirname(objects[0]),
+ self.library_filename(dll_name))
+ ld_args.append ('/IMPLIB:' + implib_file)
+
if extra_preargs:
ld_args[:0] = extra_preargs
if extra_postargs:
- ld_args.extend (extra_postargs)
+ ld_args.extend(extra_postargs)
print "link_shared_object():"
print " output_filename =", output_filename