Data Transfer between C ++ and Python

I would like to share memory between C ++ and Python.

My problem:

  • I work with large data sets (up to 6 GB of RAM) in C ++. All calculations are performed in C ++.
  • Then I want to "paste" all my results into a Python program. But I can only write my data to disk, and then read this file from Python, which is inefficient.

Is there a way to "map" the memory corresponding to C ++ variables so that I can access data from Python? I do not want to copy 6 GB of data to the hard drive.

+4
source share
1 answer

. , - ctypes. , Python , Python.

Windows DLL, Linux .so-.

, Python.

. , , , Python C. Python (PyObject s) C.

, , Python.

?:

  • ctypes, , C/++, Python.
  • Python C Extension, , Python, C/++.

++ Python / .

, .

+3

Source: https://habr.com/ru/post/1657906/