# NAG Library Routine Document

## 1Purpose

x10ab_a1w_f deletes a configuration data structure, created by x10aa_a1w_f and used by the NAG AD Library. It must be called following the final call to routines from the NAG AD Library as listed in the NAG AD Library Introduction including any other routine in Chapter X10.

## 2Specification

Fortran Interface
 Subroutine x10ab_a1w_f (
 Integer, Intent (Inout) :: ifail Type (c_ptr), Intent (Inout) :: ad_handle
extern "C" {
 void x10ab_a1w_f_ (void *&ad_handle, Integer &ifail)
}
 Declare PtrSafe Sub X10ABF Lib "libname" ( _ ad_handle As LongPtr, ifail As Long)

## 3Description

x10ab_a1w_f deletes a configuration data object, freeing the handle to the data object. This handle will have been created by a prior call to x10aa_a1w_f and passed to any routine in the NAG AD Library as listed in the NAG AD Library Introduction. The object must always be destroyed by a call to x10ab_a1w_f prior to exiting the application in which it was created.

### 3.1Life Cycle of the Handle

Each handle should pass four stages in its life: initialization; mode setting; problem solution using the NAG AD Library; and, destruction.
The initialization by x10aa_a1w_f and destruction by x10ab_a1w_f mark the beginning and the end of the life of the handle. During this time the handle must only be modified by NAG AD Library routines. Working with a handle which has not been properly initialized is potentially very dangerous as it may cause unpredictable behaviour.
After the handle has been initialized, two routines are provided to set or get the computational mode to be used in algorithmic differentiation.
The handle is then passed to the computational routines of the NAG AD Library.
When all AD computation is completed, the handle must be destroyed by x10ab_a1w_f. When more than one handle has been initialized (e.g., for different computational modes) then each handle must be destroyed separately.

None.

## 5Arguments

1:     $\mathbf{ad_handle}$ – Type (c_ptr)Input/Output
On entry: contains a handle to the AD configuration data object.
On exit: the handle is destroyed.
2:     $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, . If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value  is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is $0$. When the value  is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry: ad_handle is not a valid handle for the AD computational data object. Either ad_handle has not been initialized or it has become corrupted.
${\mathbf{ifail}}=-99$
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

Not applicable.

## 8Parallelism and Performance

x10ab_a1w_f is not threaded in any implementation.