| gclib 1.34.15 Communications API for Galil controllers and PLCs |

## ◆ GClose()

GCLIB_DLL_EXPORTED GReturn GCALL GClose | ( | GCon | g | ) |

Closes a connection to a Galil Controller.

Attention
  gclib requires that `GClose()` be called whenever a program is finished with a controller. This includes when a program closes. A rule of thumb is that for every `GOpen()` call on a given connection, a `GClose()` call should be found on every code path. Failing to call GClose() may cause controller resources to not be released or can hang the process if there are outstanding asynchronous operations. The latter can occur, for example, if a call to GRead() times out and the process exits without calling GClose(). In this case, GRead() still has an outstanding asynchronous read pending. GClose() will terminate this operation allowing the process to exit correctly.

Parameters

  g | Connection's handle.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

See x_examples.cpp for an example.