Differences
This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
en:docs:fapi:dosfreeseg [2018/08/30 16:27] – created prokushev | en:docs:fapi:dosfreeseg [2018/09/02 16:35] – prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{logos: | ||
+ | ====== DosFreeSeg ====== | ||
This call deallocates a memory segment. | This call deallocates a memory segment. | ||
==Syntax== | ==Syntax== | ||
- | | + | |
+ | | ||
==Parameters== | ==Parameters== | ||
- | ;Selector ([[SEL]]) - input : Selector of the segment to be freed. | + | |
+ | * Selector ([[SEL]]) - input : Selector of the segment to be freed. | ||
==Return Code== | ==Return Code== | ||
- | rc (USHORT) - return | + | |
+ | rc (USHORT) - return | ||
Return code descriptions are: | Return code descriptions are: | ||
- | * 0 | + | |
- | * 5 | + | * 5 |
- | * 212 | + | * 212 |
==Remarks== | ==Remarks== | ||
+ | |||
DosFreeSeg frees selectors to segments returned by allocation calls to [[DosAllocSeg]], | DosFreeSeg frees selectors to segments returned by allocation calls to [[DosAllocSeg]], | ||
Line 23: | Line 30: | ||
===Family API Considerations=== | ===Family API Considerations=== | ||
+ | |||
Some options operate differently in the DOS mode than in OS/2 mode. Therefore, the following restriction applies to DosFreeSeg when coding for the DOS mode: | Some options operate differently in the DOS mode than in OS/2 mode. Therefore, the following restriction applies to DosFreeSeg when coding for the DOS mode: | ||
Line 29: | Line 37: | ||
==Example Code== | ==Example Code== | ||
===C Binding=== | ===C Binding=== | ||
- | <PRE> | ||
- | #define INCL_DOSMEMMGR | ||
- | USHORT | + | #define INCL_DOSMEMMGR |
+ | |||
+ | | ||
+ | |||
+ | SEL Selector; | ||
+ | |||
+ | USHORT | ||
- | SEL Selector; | ||
- | |||
- | USHORT | ||
- | </ | ||
This example allocates a segment of 30,250 bytes and then discards the segment. | This example allocates a segment of 30,250 bytes and then discards the segment. | ||
- | <PRE> | ||
- | #define INCL_DOSMEMMGR | ||
- | #define NUMBER_OF_BYTES 30250 | + | #define INCL_DOSMEMMGR |
- | #define ALLOC_FLAG SEG_GETTABLE | + | |
+ | | ||
+ | #define ALLOC_FLAG SEG_GETTABLE | ||
+ | |||
+ | SEL Selector; | ||
+ | USHORT rc; | ||
+ | |||
+ | rc = DosAllocSeg(NUMBER_OF_BYTES, | ||
+ | & | ||
+ | | ||
+ | rc = DosFreeSeg(Selector); | ||
- | SEL Selector; | ||
- | USHORT rc; | ||
- | |||
- | rc = DosAllocSeg(NUMBER_OF_BYTES, | ||
- | & | ||
- | ALLOC_FLAG); | ||
- | rc = DosFreeSeg(Selector); | ||
- | </ | ||
===MASM Binding=== | ===MASM Binding=== | ||
- | <PRE> | ||
- | EXTRN DosFreeSeg: | ||
- | INCL_DOSMEMMGR | ||
- | PUSH | + | EXTRN DosFreeSeg: |
- | CALL | + | INCL_DOSMEMMGR |
+ | |||
+ | | ||
+ | CALL | ||
Returns WORD | Returns WORD | ||
- | </ | + | |