In the book "The Linux Programming Interface" it reads:
Although the code of a shared library is shared among multiple processes, its variables are not. Each process that uses the library has its own copies of the global and static variables that are defined within the library.
Is there an easier way for sharing the variables between two processes of the same library than using common IPC, like shm_open()
and mmap()
?
It feels overly complex sharing a class instance between two processes for a standard problem. Especially reading an already existing shared memory, how do I know e.g. the size of the class which I need to map into the processes memory?