<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_MemAlloc |
BYTEP FAR PASCAL sx_MemAlloc(LONG lNum);
Allocate Windows global memory. This is a useful function for the C programmer in that it is not necessary to bother with Windows memory handles and constant dereferencing to obtain a usable address.
Note: Memory allocated with sx_MemAlloc must be de-allocated with sx_MemDealloc.
lNum: The number of bytes to be allocated. The memory type allocated is Windows Global Fixed and it is initialized to binary zeroes.
A BYTEP (char far *) to the allocated memory. Always test for a NULL value, which indicates that the allocation has failed.
// create a workarea under the current task
spTask->apWorkItem[i].wpWorkArea =
(WORKAREAP) sx_MemAlloc((LONG) sizeof(WORKAREA));
if (!spTask->apWorkItem[i].wpWorkArea)
return(FALSE);
spTask->apWorkItem[i].uiFileType = (USHORT) iRdeType;
spTask->apWorkItem[i].wpWorkArea->uiArea = (USHORT) i;