#define INCL_DOSMEMMGR USHORT rc = DosAllocHuge(NumSeg, Size, Selector, MaxNumSeg, AllocFlags); USHORT NumSeg; /* Number of 65536-byte segments */ USHORT Size; /* Number of bytes in last segment */ PSEL Selector; /* The first Selector allocated (returned) */ USHORT MaxNumSeg; /* Max number of 65536-byte segments */ USHORT AllocFlags; /* Allocation flags */ USHORT rc; /* return code */
Example
This example requests a block of memory with 4 segments, the last segment having 1,040 bytes. The block of memory will never be larger than 8 segments. The memory can be shared with DosGiveSeg API calls. The system can discard the memory if it needs too.
#define INCL_DOSMEMMGR #define NUMBER_OF_SEGMENTS 4 #define BYTES_IN_LAST_SEGMENT 1040 #define MAXIMUM_SEG_SIZE 8 #define ALLOC_FLAG SEG_GIVEABLE | SEG_DISCARDABLE SEL Selector; USHORT rc; rc = DosAllocHuge(NUMBER_OF_SEGMENTS, /* # of 65536-byte segments */ BYTES_IN_LAST_SEGMENT, /* # of bytes in last segment */ &Selector, /* The 1st selector allocated */ MAXIMUM_SEG_SIZE, /* Max number of segments */ ALLOC_FLAG); /* Allocation flags */