0

so i am creating Python software that uses C++ for heavy lifting when needed through pybind11, this however made me think.

If I gave this Python app to someone who doesn't have the C++ runtime installed, would it work on his machine or give an error when the C++ code is ran? I mean those are compiled C++ modules as .dll that run through Python so technically its just binary code that Python runs right?

Flamyngo
  • 33
  • 2
  • 6
  • `C++` is not an interpreter language it is translated directly into mashine code so there is no real thing as `C++` runtime envrionment. So unless you have not linekd with any other shared or static library it should be no problem. Note that some toolchains like `MingW` use dinamically linked standard libraraies where you need to make sure that whoever uses you program has these libraries. With `MingW` you can choose to statically link these libraries. However i make this as a comment instead of an answer since i am not 100% sure. – Yastanub Jun 18 '19 at 08:18
  • @Yastanub “there is no real thing as C++ runtime envrionment” That’s not true, C++ definitely has a runtime environment (needed e.g. for exception handling and, more fundamentally, for calls to system functions, which happens via the C runtime). And unless you statically link your binaries, which is not the default anywhere as far as I’m aware, C++ does require runtime libraries to be present on the executing system. – Konrad Rudolph Jun 18 '19 at 08:58
  • @Yastanub That's not exactly true. A c++ application is compiled/linked against the e.g. `libstdc++`and if that one is not installed then you get an error like `error while loading shared libraries: libstdc++.so.5: cannot open shared object file`. But as most OS already have code that depends on those libraries it is likely that it is already installed. – t.niese Jun 18 '19 at 08:58

0 Answers0