GNU Astronomy Utilities

12.3 Gnuastro library

Gnuastro library’s programming constructs (function declarations, macros, data structures, or global variables) are classified by context into multiple header files (see Headers)253. In this section, the functions in each header will be discussed under a separate sub-section, which includes the name of the header. Assuming a function declaration is in headername.h, you can include its declaration in your source code with:

# include <gnuastro/headername.h>

The names of all constructs in headername.h are prefixed with gal_headername_ (or GAL_HEADERNAME_ for macros). The gal_ prefix stands for GNU Astronomy Library.

Gnuastro library functions are compiled into a single file which can be linked on the command-line with the -lgnuastro option. See Linking and Summary and example on libraries for an introduction on linking and some fully working examples of the libraries.

Gnuastro’s library is a high-level library which depends on lower level libraries for some operations (see Dependencies). Therefore if at least one of Gnuastro’s functions in your program use functions from the dependencies, you will also need to link those dependencies after linking with Gnuastro. See BuildProgram for a convenient way to deal with the dependencies. BuildProgram will take care of the libraries to link with your program (which uses the Gnuastro library), and can even run the built program afterwards. Therefore it allows you to conveniently focus on your exciting science/research when using Gnuastro’s libraries.

Libraries are still under heavy development: Gnuastro was initially created to be a collection of command-line programs. However, as the programs and their the shared functions grew, internal (not installed) libraries were added. Since the 0.2 release, the libraries are install-able. Hence the libraries are currently under heavy development and will significantly evolve between releases and will become more mature and stable in due time. It will stabilize with the removal of this notice. Check the NEWS file for interface changes. If you use the Info version of this manual (see Info), you do not have to worry: the documentation will correspond to your installed version.



Within Gnuastro’s source, all installed .h files in lib/gnuastro/ are accompanied by a .c file in /lib/.