[<<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()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson