Click or drag to resize

MemGrpOpen Function

X#
Open up a new memory group.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION MemGrpOpen() AS DWORD
Request Example View Source

Return Value

Type: DWord
If successful, the handle of the new group; otherwise, 0. You should always check for a valid group handle.
Remarks
MemGrpOpen() opens up a new memory group. In conjunction with MemGrpAlloc(), MemGrpOpen() allows you to group or organize dynamically allocated memory buffers.
Tip Tip
This function allows the direct manipulation of a memory location and should be used with extreme care.
Remarks
Tip Tip
The Static Memory Functions (MemAlloc, MemSet etc) are included for compatibility only. In most cases the static memory blocks can (and should) be replaced with arrays of bytes.
Many of the functions in the runtime that take memory blocks as parameter, such as the low level IO functions, now have overloads that take arrays of bytes as parameter.
We recommend that you use these overloads, because their performance is somewhat better.
Examples
This example uses MemGrpOpen() and checks for a valid group number:
X#
1wGrp := MemGrpOpen()
2IF wGrp = 0
3    ? "Unsuccessful - invalid handle"
4ELSE
5    ? "New valid handle", wGrp
6ENDIF
See Also