C - shared memory - dynamic array inside shared struct
i'm trying to share a struct like this example: typedef struct { int* a; int b; int c; } ex; between processes, the problem is that when I initialize 'a' with a malloc, it becomes private to the heap of the process that do this(or at least i think this is what happens). Is there any way to create a shared memory (with shmget, shmat) with this struct that works? EDIT: I'm working on Linux. EDIT: I have a process that initialize the buffer like this: key_t key = ftok("gr", 'p'); int mid = shmget(key, sizeof(ex), IPC_CREAT | 0666); ex* e = NULL; status b_status = init(&e, 8); //init gives initial