Mr xtang:
Thanks for your concern. In openqnx, I saw mario’s post:
I like to make the share memory map to a C structure. That way all
programs just use the C structure as reference for the data layout in
the shared memory, adding a mutext/rwl/etc to that structure becomes
trivial.
Now I want to use this way: The following is my code:
#include<_pack1.h>
typedef struct{
int8_t sub1;
int16_t sub2;
int32_t sub3;
} DATA;
.
.
DATA *p;
.
.
fd=shm_open(…);
.
p=mmap(0,sizeof(DATA), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
.
p->sub1 = 0x4a;
p->sub2 = 0x4a3b;
p->sub3 = 0x4aff6b2e;
.
.
(in another process):
.
.
printf(“02x,02x,02x”,p->sub1, p->sub2, p->sub3);
.
is my method right? If not ok, kindly give me some guidance
many thanks