Structure of a client program

Since the client side of DIET is a library, a client program has to define a main function that uses DIET through function calls. The complete client-side interface is described in the files DIET_data.h (see Chapter 3) and DIET_client.h found in install_dir/include. Please refer to these two files for a complete and up-to-date API 4.1description, and include at least the latter at the beginning of your source code (DIET_client.h includes DIET_data.h):

#include <stdio.h>
#include <stdlib.h>

#include "DIET_client.h"

int main(int argc, char *argv[])
{
  diet_initialize(configuration_file, argc, argv);
  // Successive DIET calls ...
  diet_finalize();
}

The client program must open its DIET session with a call to diet_initialize, which parses the configuration file to set all options and get a reference to the DIET Master Agent. The session is closed with a call to diet_finalize, which frees all resources associated with this session on the client. Note that memory allocated for all INOUT and OUT arguments brought back onto the client during the session is not freed during diet_finalize; this allows the user to continue to use the data, but also requires that the user explicitly free the memory. The user must also free the memory he or she allocated for IN arguments.

The DIET Team - Mer 29 nov 2017 15:13:36 EST