Documentation Project 1
ContentsIndexHome
PreviousUpNext
sack::memory::OpenSpaceExx Function
C++
MEM_PROC POINTER MEM_API OpenSpaceExx(CTEXTSTR pWhat, CTEXTSTR pWhere, PTRSZVAL address, PTRSZVAL * dwSize, P_32 bCreated);
#define OpenSpaceEx( what,where,address,psize) OpenSpaceExx( what,where,address,psize,NULL )
Parameters 
Description 
CTEXTSTR pWhat 
String to a named shared memory region. NULL is unnamed. 
CTEXTSTR pWhere 
Filename to back the shared memory with. The file name itself may also be used to share the memory
PTRSZVAL address 
A base address to map the memory at. If 0, specifies do not care. 
PTRSZVAL * dwSize 
pointer to a PTRSZVAL that defines the size to create. If 0, then the region is only opened. The size of the region opened is set back into this value after it is opened. 
P_32 bCreated 
pointer to a boolean to indicate whether the space was created or not. 

Pointer to region requested to be opened. NULL on failure.

Open a shared memory region. The region may be named with a text string (this does not work under linux platforms, and the name of the file to back the shared region is the sharing point). The region may be backed with a file (and must be if it is to be shared on linux. 

If the region exists by name, the region is opened, and a pointer to that region is returned. 

If the file exists, the file is opened, and mapped into memory, and a pointer to the file backed memory is returned. 

if the file does not exist, and the size parameter passed is not 0, then the file is created, and expanded to the size requested. The bCreate flag is set to true. 

If NULL is passed for pWhat and pWhere, then a block of memory is allocated in system memory, backed by pagefile. 

if dwSize is 0, then the region is specified for open only, and will not create.

Many examples of this are appropriate. 

1) Open or create a file backed shared space. 

2) Open a file for direct memory access, the file is loaded into memory by system paging routines and not any API.

Copyright (c) 2010. All rights reserved.
What do you think about this topic? Send feedback!