View Single Post
  #7 (permalink)  
Old 29-Jun-2009, 23:02
castord's Avatar
castord castord is offline
Student Penguin
 
Join Date: Jun 2008
Location: As. - Paraguay - GMT -4
Posts: 95
castord hasn't been rated much yet
Default Re: Shared memory and C++

Finally.

I think I should write my own shared memory heap-like manager.

Doing the following I made it work properly.

Code:
SharedMemory *sm1 	= new SharedMemory(SHAMEM_ID, 1600, true);
void *pool		= sm1->Get();		test *tp			= (test *)pool;
tp->c			= (test2 *)(new SharedMemory ( SHAMEM_ID + 10, sizeof(test2) * 10, true ))->Get();		test *t			= new test;
t->a =  123;
t->b = 234;
t->c = (test2 *) malloc(sizeof(test2) * 10);
t->c[0].a =  777;
t->c[7].a =  888;
Clone(t, pool);
Reply With Quote