Skip to content

C89 crossplatform shared memory single-header library

License

Notifications You must be signed in to change notification settings

alexlnkp/sharedmem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sharedmem - Cross-platform shared memory single-header-library for ANSI C

Pretty barebones at the moment, bugs (ESPECIALLY WITH PERMISSIONS) are expected.
Works for Windows and Linux. Requires a C compiler with support of at the very least C89.

To see a complete example of two different processes (programs) communicating, refer to `test` folder.
There, you will see three additional folders, "crossplatform", "linux" and "win". "linux" & "win" are for
platform-specific code, so "linux" code MAY only run on linux, and "win" code MAY only run on windows.
"crossplatform", though, provides code that behaves identical, no matter the platform (except for a few nuances).

Inconsistencies between platforms at the moment:
- if you restart the sender on linux, the reader doesn't notice
  and still prints the last value from counter that was there on exit,
  however, on windows, the reader immediately picks up on that sender
  has started counting from scratch. example:
    ON LINUX:
      sender: counter=4
      reader: counter=4
      (sender gets killed)
      sender: dead
      reader: counter=4
      (sender gets started again)
      sender: counter=1
      reader: counter=4
      (next second)
      sender: counter=2
      reader: counter=4
      (...)
    ON WINDOWS:
      sender: counter=4
      reader: counter=4
      (sender gets killed)
      sender: dead
      reader: counter=4
      (sender gets started again)
      sender: counter=1
      reader: counter=1
      (next second)
      sender: counter=2
      reader: counter=2
      (...)

Releases

No releases published

Packages

No packages published