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>_xvfree()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _xvfree()
 Free an allocated VM segment
------------------------------------------------------------------------------
 C Prototype

     #include "vm.api"
     void _xvfree(
                   HANDLE hSegment
                 )

 Arguments

     hSegment is the VM segment handle returned by _xvalloc().

 Returns

     _xvfree() has no return value.

 Description

     _xvfree() releases a VM segment previously allocated by _xvalloc() and
     invalidates the handle of that segment.

     Warning!  Do not use _xvfree() to free a locked segment.  Use
     _xvlockcount() to determine the number of locks on a segment and
     _xvunlock() to release the locks.

 Examples

     .  This example allocates a segment with _xvalloc() and locks it
        with _xvlock().  After a string is copied into the locked segment,
        the segment is unlocked and freed (with _xvunlock() and _xvfree()):

        // CA-Clipper include files
        #include "extend.api"
        #include "vm.api"

        // Microsoft C include files
        #include "string.h"

        // Prototype
        Boolean VMExample(char * spSrc);


        Boolean VMExample(char * spSrc)
        {
           HANDLE hSegment;
           char * spString;
           Boolean bResult = FALSE;

           if (hSegment = _xvalloc(strlen(spSrc) + 1, 0))
              {
              spString = _xvlock(hSegment);
              if (spString != NULL)
                 {
                 strcpy(spString, spSrc);

                 .
                 . <statements>
                 .

                 bResult = TRUE;

                 _xvunlock(hSegment);
                 }
              _xvfree(hSegment);
              }

           return (bResult);
        }

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


See Also: _xvalloc() _xvlockcount() _xvunlock()

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