I am just starting out with Pybind11 for python bindings with C++ code. Using CMake, the C++ files having functionalities to be imported in python are compiled to a .so(shared library) file in Linux. My question is that after compilation do the .so file need the C++ compiler to be present in the system for my python program to use those functions? For e.g, if I just transferred the .so file to another Linux system with C++ installed and tried to import in a python file, will it work?
- No. The dynamic linker (ld.so) is responsible for loading libraries as needed. A C++ compiler is only one way to generate these libraries.Botje– Botje2022-10-12 08:18:43 +00:00Commented Oct 12, 2022 at 8:18
- But my question was whether that linker is depended on C++ installation?Tarique– Tarique2022-10-12 09:36:20 +00:00Commented Oct 12, 2022 at 9:36
- 1It is not. The dynamic loader is an integral part of the operating system and has nothing to do with a C++ compiler.Botje– Botje2022-10-12 18:25:43 +00:00Commented Oct 12, 2022 at 18:25
Add a comment |