0

I have read many articles about methods (ctypes, cython, pybind11, etc.) of binding Python code with C++, more specifically using functions written in C++ from Python.

Recently I have read about the concept of "shared memory" between C++ and Python.

What is the main difference between "shared memory" and methods such as pybind11?

user
  • 1
  • 1
  • AFAIK, shared memory behave more or less like a data file, except that is resides in memory. Using shared memory between Python and C++ ends in 2 separate processes, one in C++ and one in Python. For example a Python process to store input data in shared memory, launch the C++ program that produces the output data still in shared memory, wait for it to finish and in the end uses the data produced by the C++ program. In fact you only define a *data* interface between independant processes. – Serge Ballesta Sep 22 '22 at 12:17
  • Thank you for your answer @SergeBallesta! So, basically if I want to "automatically" call a function, for example, in Python, but that function is actually written in C++, is easier and more convenient to use use a tool like pybind11, right? – user Sep 22 '22 at 12:24
  • Mixed language programming is not really a piece of cake anyway. Make sure to follow a tuto for the first time... – Serge Ballesta Sep 22 '22 at 12:37

0 Answers0