In an indirect way, you can apply for a shared memory block with a "shared name" for read/write:
Handle getshare (char * & sharep, int size, char * sharename)
{Sharep ApplicationOfMemory block address, size bytes, sharename shared name
Handle FH = createfilemapping (handle)-1, 0,
Page_readwrite, 0,
Size,
Sharename );
Sharep = (char *) mapviewoffile (FH,
File_map_all_access,
0, 0 );
If (getlasterror ()! = Error_already_exists)
Zeromemory (sharep, size); // share area Initialization
Return (FH );
}
Char * sharep = NULL;
Void test () // request a piece of 128 bytesOfCharacter array
{
Handle FH = getshare (sharep, 128, "formyprog ");
For (INT I = 0; I <128; I ++)
Sharep [I] = I;
Closehandle (FH );
}
Handle getshare (char * & sharep, int size, char * sharename)
{Sharep ApplicationOfMemory block address, size bytes, sharename shared name
Handle FH = createfilemapping (handle)-1, 0,
Page_readwrite, 0,
Size,
Sharename );
Sharep = (char *) mapviewoffile (FH,
File_map_all_access,
0, 0 );
If (getlasterror ()! = Error_already_exists)
Zeromemory (sharep, size); // share area Initialization
Return (FH );
}
Char * sharep = NULL;
// Apply for a block of 128 bytesOfCharacter array
Handle FH = getshare (sharep, 128, "formyprog"); file: // apply for an array of 128 byte characters
For (INT I = 0; I <128; I ++) file: // use, test
Sharep [I] = I;
.....................
Closehandle (FH); // release the shared memory handle