MYSTRUCT *MYSTRUCT; APIRET rc; rc = DosAllocSharedMem(&MyStruct, /* Allocate memory object */ NULL, /* Anonymous memory object */ sizeof(MYSTRUCT), /* Size of memory object */ OBJ_GIVEABLE | /* Object is giveable */ PAG_WRITE | /* Write access is allowed */ PAG_READ | /* Read access is allowed */ PAG_COMMIT); /* Commit storage immediately */ rc = DosGiveSharedMem(MyStruct, /* Give access to object */ pidOther, /* Process to receive access */ PAG_WRITE | /* Write access is allowed */ PAG_READ); /* Read access is allowed */
This example shows the use of the DosAllocSharedMem() function, declaring a memory object as "giveable".