C interface reference

The C interface is define in the chemfiles.h, in which all the functions and enums have a chfl_ prefix for namespacing. Main chemfiles types are the following opaque pointer types:

The user is reponsible for memory management when using these types. Constructors functions (functions returning pointers to types defined above) return freshly allocated memory, and calling the chfl_free() function return the corresponding memory to the operating system.

void chfl_free(const void *object)

Free the memory associated with a chemfiles object.

This function is NOT equivalent to the standard C function free, as memory is acquired and released for all chemfiles objects using a references counter to allow direct modification of C++ objects.

typedef double chfl_vector3d[3]

A 3-dimensional vector for the chemfiles interface.

chemfiles.h also exports the same macro as in the C++ interface, and the chfl_version function allow to access the version of the Chemfiles library.

const char *chfl_version(void)

Get the version of the chemfiles library.

Returns:

A null-terminated string containing the version of Chemfiles.