User Tools

Site Tools


pentominos:libartefact

This is an old revision of the document!


libartefact

Introduction

Libartefact is a client library that can be used to connect to the Artefact data server, for data retrieval and insertion.
The library takes care of http communication, encryption/decryption (optionally), XML translations and error handling. It is intended as a complete interface to the communication possibilities with the Artefact server.

How to use libartefact

To use libartefact, simply include libartefact.h in your c file. The project supplies a pkg-config file called libartefact.pc, that should be located in the ${prefix}/lib/pkg-config/, where ${prefix} is the base directory in which the library is installed. This will be /usr on most systems. In order to use it simply add

PKG_CHECK_MODULES(ATF, libartefact >= 0.0.1)

to configure.in, and supply ATF_CFLAGS to the cflags and ATF_LIBS to the libs of your project Makefile.am. Alternatively use the pkg-config –libs libartefact and pkg-config –cflags libartefact commands directly in your Makefile (if not using autotools).

API overview

atf_handle_t *handle = atf_init();
void atf_close(handle);

Error handling

// ... here should be some code that allocates handle and does something useful ...
 
atf_error_t err = atf_get_last_error(handle);
 
if(err != ATF_NO_ERROR) {
  char buf[512];
  printf("Error: %s\n", atf_get_error_string(err, buf, sizeof(buf));
}
pentominos/libartefact.1264751988.txt.gz · Last modified: 2010/01/29 08:59 by deva