class_docstr: Handles the Cygwin port of the GNU C compiler to Windows.
class_docstr_tok: ["Handles","the","Cygwin","port","of","the","GNU","C","compiler","to","Windows","."]
docstr: Link the objects.
docstr_tok: ["Link","the","objects","."]
code: def link(
      self,
      target_desc,
      objects,
      output_filename,
      output_dir=None,
      libraries=None,
      library_dirs=None,
      runtime_library_dirs=None,
      export_symbols=None,
      debug=0,
      extra_preargs=None,
      extra_postargs=None,
      build_temp=None,
      target_lang=None,
  ):
      """Link the objects."""
      # use separate copies, so we can modify the lists
      extra_preargs = copy.copy(extra_preargs or [])
      libraries = copy.copy(libraries or [])
      objects = copy.copy(objects or [])
  
      if runtime_library_dirs:
          self.warn(_runtime_library_dirs_msg)
  
      # Additional libraries
      libraries.extend(self.dll_libraries)
  
      # handle export symbols by creating a def-file
      # with executables this only works with gcc/ld as linker
      if (export_symbols is not None) and (
          target_desc != self.EXECUTABLE or self.linker_dll == "gcc"
      ):
          # (The linker doesn't do anything if output is up-to-date.
          # So it would probably better to check if we really need this,
          # but for this we had to insert some unchanged parts of
          # UnixCCompiler, and this is not what we want.)
  
          # we want to put some files in the same directory as the
          # object files are, build_temp doesn't help much
          # where are the object files
          temp_dir = os.path.dirname(objects[0])
          # name of dll to give the helper files the same base name
          (dll_name, dll_extension) = os.path.splitext(
              os.path.basename(output_filename)
          )
  
          # generate the filenames for these files
          def_file = os.path.join(temp_dir, dll_name + ".def")
  
          # Generate .def file
          contents = [
              "LIBRARY %s" % os.path.basename(output_filename),
              "EXPORTS",
          ]
          for sym in export_symbols:
              contents.append(sym)
          self.execute(
              write_file, (def_file, contents), "writing %s" % def_file
          )
  
          # next add options for def-file
  
          # for gcc/ld the def-file is specified as any object files
          objects.append(def_file)
  
      # end: if ((export_symbols is not None) and
      #        (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")):
  
      # who wants symbols and a many times larger output file
      # should explicitly switch the debug mode on
      # otherwise we let ld strip the output file
      # (On my machine: 10KiB < stripped_file < ??100KiB
      #   unstripped_file = stripped_file + XXX KiB
      #  ( XXX=254 for a typical python extension))
      if not debug:
          extra_preargs.append("-s")
  
      UnixCCompiler.link(
          self,
          target_desc,
          objects,
          output_filename,
          output_dir,
          libraries,
          library_dirs,
          runtime_library_dirs,
          None,  # export_symbols, we do this in our def-file
          debug,
          extra_preargs,
          extra_postargs,
          build_temp,
          target_lang,
      )
  
imports: import os
  import re
  import sys
  import copy
  import shlex
  import warnings
  from subprocess import check_output
  from .unixccompiler import UnixCCompiler
  from .file_util import write_file
  from .errors import DistutilsExecError, DistutilsPlatformError, CCompilerError, CompileError
  from .version import LooseVersion, suppress_known_deprecation
  from ._collections import RangeMap
label_desc: Use image node_id 4 for calling the CygwinCCompiler obj's underlying member method code with example usage: obj.link(target_desc, objects, output_filename, output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols, debug, extra_preargs, extra_postargs, build_temp, target_lang) without return types