Jump to content

DosSubFree: Difference between revisions

From EDM2
Created page with "==Description== This call frees memory previously allocated by DosSubAlloc. ==Syntax== <PRE> DosSubFree (SegSelector, BlockOffset, Size) </PRE> ==Parameters== ; SegSe..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
This call frees memory previously allocated by DosSubAlloc.
This call frees memory previously allocated by DosSubAlloc.  


==Syntax==
==Syntax==
<PRE>
  DosSubFree (SegSelector, BlockOffset, Size)
  DosSubFree


    (SegSelector, BlockOffset, Size)
</PRE>
==Parameters==
==Parameters==
; SegSelector (SEL) - input : Data segment selector.  
;SegSelector (SEL) - input : Data segment selector.
 
;BlockOffset (USHORT) - input : Memory block offset. The value specified must equal the BlockOffset returned on a previous DosSubAlloc call.
; BlockOffset (USHORT) - input : Memory block offset. The value specified must equal the BlockOffset returned on a previous DosSubAlloc call.  
;Size (USHORT) - input :  Size, in bytes, of the block to be freed.


; Size (USHORT) - input :  Size, in bytes, of the block to be freed.
==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
* 0 NO_ERROR
Return code descriptions are:
*312 ERROR_DOSSUB_OVERLAP
 
*313 ERROR_DOSSUB_BADSIZE
* 0         NO_ERROR  
* 312       ERROR_DOSSUB_OVERLAP  
* 313       ERROR_DOSSUB_BADSIZE


==Remarks==
==Remarks==
DosSubFree specifies the offset of a block of memory previously suballocated by a DosSubAlloc request. If the block specified overlaps memory in the segment that is not suballocated, an error is returned. Like DosSubAlloc, the size parameter must be a multiple of four bytes; otherwise, it is rounded up to a multiple of four bytes.
DosSubFree specifies the offset of a block of memory previously suballocated by a [[DosSubAlloc]] request. If the block specified overlaps memory in the segment that is not suballocated, an error is returned. Like DosSubAlloc, the size parameter must be a multiple of four bytes; otherwise, it is rounded up to a multiple of four bytes.


The allocated segment is freed by calling DosFreeSeg.  
The allocated segment is freed by calling DosFreeSeg.


==Example Code==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSMEMMGR
#define INCL_DOSMEMMGR
Line 35: Line 27:
USHORT  rc = DosSubFree(SegSelector, BlockOffset, Size);
USHORT  rc = DosSubFree(SegSelector, BlockOffset, Size);


SEL             SegSelector;  /* Segment selector */
SEL     SegSelector;  /* Segment selector */
USHORT           BlockOffset;  /* Offset of memory block to free */
USHORT BlockOffset;  /* Offset of memory block to free */
USHORT           Size;          /* Size of block in bytes */
USHORT Size;          /* Size of block in bytes */


USHORT           rc;            /* return code */
USHORT rc;            /* return code */
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
EXTRN  DosSubFree:FAR
EXTRN  DosSubFree:FAR
Line 54: Line 46:
Returns WORD
Returns WORD
</PRE>
</PRE>
==Related Functions==
*


[[Category:The OS/2 API Project]]
[[Category:Dos16]]

Latest revision as of 08:10, 26 January 2020

This call frees memory previously allocated by DosSubAlloc.

Syntax

DosSubFree (SegSelector, BlockOffset, Size)

Parameters

SegSelector (SEL) - input
Data segment selector.
BlockOffset (USHORT) - input
Memory block offset. The value specified must equal the BlockOffset returned on a previous DosSubAlloc call.
Size (USHORT) - input
Size, in bytes, of the block to be freed.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 312 ERROR_DOSSUB_OVERLAP
  • 313 ERROR_DOSSUB_BADSIZE

Remarks

DosSubFree specifies the offset of a block of memory previously suballocated by a DosSubAlloc request. If the block specified overlaps memory in the segment that is not suballocated, an error is returned. Like DosSubAlloc, the size parameter must be a multiple of four bytes; otherwise, it is rounded up to a multiple of four bytes.

The allocated segment is freed by calling DosFreeSeg.

Bindings

C

#define INCL_DOSMEMMGR

USHORT  rc = DosSubFree(SegSelector, BlockOffset, Size);

SEL     SegSelector;   /* Segment selector */
USHORT  BlockOffset;   /* Offset of memory block to free */
USHORT  Size;          /* Size of block in bytes */

USHORT  rc;            /* return code */

MASM

EXTRN  DosSubFree:FAR
INCL_DOSMEMMGR      EQU 1

PUSH   WORD    SegSelector   ;Segment selector
PUSH   WORD    BlockOffset   ;Offset of memory block to free
PUSH   WORD    Size          ;Size of block in bytes
CALL   DosSubFree

Returns WORD