Skip to content

Inter-script communication between C++ and Python using Shared Memory

License

Notifications You must be signed in to change notification settings

TzeLun/CPP-Python_SharedMemory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPP-Python_SharedMemory

Inter-script communication between C++ and Python using Shared Memory for Unix system.

How to use:

Build the CMAKELists.txt file in a designated build directory. Then run shm_test.cpp first, followed by shmpy.py.

\\ Inside a directory where this repository is cloned to or the files are saved at
$ mkdir build && cd build
$ cmake ..
$ cmake --build .

To run the C++ (shared memory creator) script:

$ cd build // if not yet in build directory
$ ./shm_test

To run the Python script (shared memory reader), open a new terminal, access the project directory:
If python is configured as python3:

$ python shmpy.py

Otherwise, use this command:

$ python3 shmpy.py

Note:

Only Python >= 3.8 supports shared_memory module. So make sure to have the right version installed. In the CMAKELists.txt file, shmpy.py was added as an executables.

If this script is omitted, running this script independently will result in failure to access the shared memory created by C++.

Releases

No releases published

Packages

No packages published