Support dynamic lookup for Python in the new module system
First, the dynamic lookup support for Python is done via -undefined dynamic_lookup
. This affects all symbol lookups. Is there some way we could get the lookups to be narrower?
In addition, the new module system uses CMake's target-based linking rules, so there's no place to put "please link this with dynamic lookup" flags (see cmake/cmake#16543 (closed)), and therefore OPTIONAL_PYTHON_LINK
doesn't really fit in well. Ideally, Python.h
would declare its symbols as __attribute__((weak))
when compiling Python modules, but that's probably only going to help people 6 years from now (not that we shouldn't pursue it).
Cc: @iMichka @jcfr @brad.king @robertmaynard @utkarsh.ayachit