/SharedMemExample

Unix shared memory example for macOS in Swift and C

Primary LanguageC

Simple Shared Memory Example Code for macOS

Here is a Swift project that shows how to use Unix shared memory. Compile and run it from Xcode. Look for output on the console. Set your command line arguments in the Scheme.

To compile the C version: run make from the command line. To run it: ./shm server <msg> | client | delete

Remember to delete the shared memory segment when done.

Xcode Swift code completion is helpful in figuring out how to call C lib functions. You will need a bridging header to #import headers for C lib stuff so Swift can see them.