[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _xalloc()
 Allocate memory and return NULL if unsuccessful
------------------------------------------------------------------------------
 C Prototype

     #include "fm.api"
     void far * _xalloc(
                         unsigned int uiSize
                       )

 Arguments

     uiSize is the number of bytes to allocate.

 Returns

     _xalloc() returns a far pointer to the allocated memory or NULL if the
     requested memory could not be allocated.

 Description

     _xalloc() lets a C or Assembly language function allocate memory from
     CA-Clipper's fixed heap.  If the allocation request is unsuccessful,
     CA-Clipper returns a NULL pointer.

     Use _xfree() to free memory allocated with _xalloc() after use.

     Warning!  Fixed memory returned from _xalloc() is not cleared by the
     system and is, therefore, in an uninitialized state.

 Examples

     .  From C:

        char *mem;
        mem = (char)_xalloc(320);

     .  From Assembly language:

        EXTRN __xalloc:FAR
              mov   ax, 320
              push  ax
              call  __xalloc            ; pointer in DX:AX
              add   sp, 2               ; reset stack pointer

 Files  Library is CLIPPER.LIB, header file is Fm.api.


See Also: _xfree() _xgrab()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson