How To Make Shared Memory (mmap woun't do it!) Aliased To Pre-Existing C Struct Memory?

From: Christopher M. Lusardi (clusardi2k_at_aol.com)
Date: 05/19/04


Date: 19 May 2004 08:55:38 -0700

Hello,

   My problem is I am in the process of changing the implimentation of
my shared memory.

   What I want to do is use something such as mmap to access shared
memory and to overlay my struct memory onto shared memory. Is it even
possible? Do you have a simple coding example that will do this?

So, I basically have in old code :

struct
{
   int status [300];
   float black_box [300];
   char message [300 * 4];
} shared_memory;

   I then use shared_memory.status [0] to access the first element
etc.

   How can I use the dotted identifier "shared_memory" and have it
refer to shared memory out there some where?

Thank you,
Christopher Lusardi



Relevant Pages


Quantcast