Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Technical Reference - <b>_xalloc()</b> http://www.X-Hacker.org [<<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()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson