MCPcopy Create free account
hub / github.com/numpy/numpy / wrap_unlinkable_objects

Method wrap_unlinkable_objects

numpy/distutils/fcompiler/gnu.py:480–523  ·  view source on GitHub ↗

Convert a set of object files that are not compatible with the default linker, to a file that is compatible.

(self, objects, output_dir, extra_dll_dir)

Source from the content-addressed store, hash-verified

478 return compiler.compiler_type not in ("msvc", )
479
480 def wrap_unlinkable_objects(self, objects, output_dir, extra_dll_dir):
481 """
482 Convert a set of object files that are not compatible with the default
483 linker, to a file that is compatible.
484 """
485 if self.c_compiler.compiler_type == "msvc":
486 # Compile a DLL and return the lib for the DLL as
487 # the object. Also keep track of previous DLLs that
488 # we have compiled so that we can link against them.
489
490 # If there are .a archives, assume they are self-contained
491 # static libraries, and build separate DLLs for each
492 archives = []
493 plain_objects = []
494 for obj in objects:
495 if obj.lower().endswith('.a'):
496 archives.append(obj)
497 else:
498 plain_objects.append(obj)
499
500 chained_libs = []
501 chained_dlls = []
502 for archive in archives[::-1]:
503 lib, dll = self._link_wrapper_lib(
504 [archive],
505 output_dir,
506 extra_dll_dir,
507 chained_dlls=chained_dlls,
508 is_archive=True)
509 chained_libs.insert(0, lib)
510 chained_dlls.insert(0, dll)
511
512 if not plain_objects:
513 return chained_libs
514
515 lib, dll = self._link_wrapper_lib(
516 plain_objects,
517 output_dir,
518 extra_dll_dir,
519 chained_dlls=chained_dlls,
520 is_archive=False)
521 return [lib] + chained_libs
522 else:
523 raise ValueError("Unsupported C compiler")
524
525
526def _can_target(cmd, arch):

Callers

nothing calls this directly

Calls 3

_link_wrapper_libMethod · 0.95
endswithMethod · 0.80
lowerMethod · 0.80

Tested by

no test coverage detected