glip  0.1.0-dev
The Generic Logic Interfacing Project
Library Initialization/Deinitialization

Functions

int glip_new (struct glip_ctx **ctx, char *backend_name, struct glip_option backend_options[], size_t num_backend_options)
 
int glip_free (struct glip_ctx *ctx)
 

Detailed Description

Before using any of the library's functionality, it's necessary to initialize it. After using it, you need to free all claimed resources again.

To create a new library instance, call glip_new() and pass the name of the used backend and all necessary options (e.g. connection parameters). The available options differ from backend to backend, refer to the backend documentation for details. As result you get an initialized library context of type struct glip_ctx. This context needs to be passed to all other GLIP function calls, and is similar to a this pointer in C++.

After you're done using GLIP, free all resources by calling glip_free().

Function Documentation

int glip_new ( struct glip_ctx **  ctx,
char *  backend_name,
struct glip_option  backend_options[],
size_t  num_backend_options 
)

Create a new GLIP context (constructor)

Call this function to create a new glip library context for the backend with ID backend_id. The resulting context is allocated by this function; you need to free those resources with glip_free().

You can specify the options to be used by the backend by passing those to backend_options, and passing the number of entries in the backend_options array to num_backend_options.

Parameters
[out]ctxthe newly created library context, or NULL if something went wrong
[in]backend_namethe name of the used backend
[in]backend_optionsoptions (key/value pairs) for the library and the backend
[in]num_backend_optionsnumber of entries in the options array
Returns
0 if the call was successful
-GLIP_EUNKNOWNBACKEND the specified backend_name is not available
any other value indicates an error
int glip_free ( struct glip_ctx ctx)

Free all library resources (destructor)

The ctx object is invalid after calling this function and may not be accessed any more.

Parameters
ctxthe library context
Returns
0 if the call was successful, or an error code if something went wrong