en:docs:win16:api:kernel:localinit

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:docs:win16:api:kernel:localinit [2026/02/08 09:33] prokusheven:docs:win16:api:kernel:localinit [2026/02/08 16:07] (current) prokushev
Line 8: Line 8:
 ===== Syntax ===== ===== Syntax =====
 <code c> <code c>
-BOOL LocalInit(+BOOL WINAPI LocalInit(
   WORD  wSegment,   WORD  wSegment,
   WORD  wOffset,   WORD  wOffset,
Line 25: Line 25:
  
 ===== Notes ===== ===== Notes =====
-  * <code>LocalInit</code> is specific to the 16-bit Windows environment and is not supported in Win32 or later. 
   * The function sets up a local heap manager within the provided segment, enabling local memory allocation functions to operate within that segment.   * The function sets up a local heap manager within the provided segment, enabling local memory allocation functions to operate within that segment.
-  * Applications typically call <code>LocalInit</code> during initialization of a data segment or a dynamically allocated memory block intended for use as a local heap+  * Applications typically call LocalInit during initialization of a data segment or a dynamically allocated memory block intended for use as a local heap.
-  * The heap size (<code>wHeapSize</code>) must be large enough to accommodate heap management overhead. +
-  * For compatibility and performance reasons, modern Windows applications should use the standard heap functions (e.g., <code>HeapCreate</code>, <code>HeapAlloc</code>) instead.+
  
 ===== Example Code ===== ===== Example Code =====
Line 37: Line 34:
 #include <windows.h> #include <windows.h>
  
-BOOL InitializeLocalHeap(WORD seg, WORD offset, WORD size) {+BOOL WINAPI InitializeLocalHeap(WORD seg, WORD offset, WORD size) {
     return LocalInit(seg, offset, size);     return LocalInit(seg, offset, size);
 } }
Line 45: Line 42:
 <file> <file>
 ; Assume AX = segment, DX = offset, CX = heap size ; Assume AX = segment, DX = offset, CX = heap size
-push cx          ; wHeapSize 
-push dx          ; wOffset 
 push ax          ; wSegment push ax          ; wSegment
 +push dx          ; wOffset
 +push cx          ; wHeapSize
 call LocalInit   ; Returns AX = non-zero if success call LocalInit   ; Returns AX = non-zero if success
 </file> </file>