As you write your code, ch will point to some kind of shared memory, but ch itself (i.e. a pointer) will not be shared. Since the assignment of ch occurs only in the child, the parent will continue to see ch as NULL.
You have two ways to fix this:
- Set up shared memory before plug.
- Let the parent and child languages ββopen the same shared memory.
When working with records in shared memory, you need to make sure that all data for this record exists in shared memory. For example, in this code:
ch->name=ugur; ch->surname=cedric;
It looks like mylist :: name is a char *. If ch points to an entry in shared memory, this will only result in pointers to names in shared memory. Unless you take specific steps to transfer these lines to shared memory, they will be in normal memory and probably will not be available to other programs.
source share