Condividi tramite


_FreeObject( ) API Library Routine

Releases an object from the Visual FoxPro API data pool.

void _FreeObject(Value FAR *objct)

Remarks

Use _FreeObject( ) to free an object from the Visual FoxPro API object table.

_FreeObject( )is used in the following cases:

1. If an object reference is returned from any Visual FoxPro API function (for example, _Evaluate( ) or _GetObjectProperty( )), you must use _FreeObject( ) to release the object when you are no longer using it.

2. If you keep a reference to an object across different Visual FoxPro API calls, you must first use _ObjectReference( ) to increment the count for the object. When you are no longer using the object, you must then use _ObjectRelease( ) to decrement the count for the object and then use _FreeObject( ) to release the object.

In addition to the previous rules, you should always clear the Value structure you pass to any Visual FoxPro API function that returns a value into the passed Value structure. For example, you can create and call a function that clears the structure prior to calling any function that returns a value into your structure. You can also create and call a function to cleanup any object references or unused handles.

0 is returned unless an error occurs. When an error occurs, a negative number representing an internal error code is returned.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.

See Also

_ObjectReference( ) API Library Routine | _ObjectRelease( ) API Library Routine | _GetObjectProperty( ) API Library Routine | _Evaluate( ) API Library Routine