GNU Astronomy Utilities

Next: , Previous: , Up: GNU Astronomy Utilities   [Contents][Index]

12 Library

Each program in Gnuastro that was discussed in the prior chapters (or any program in general) is a collection of functions that is compiled into one executable file which can communicate directly with the outside world. The outside world in this context is the operating system. By communication, we mean that control is directly passed to a program from the operating system with a (possible) set of inputs and after it is finished, the program will pass control back to the operating system. For programs written in C and C++, the unique main function is in charge of this communication.

Similar to a program, a library is also a collection of functions that is compiled into one executable file. However, unlike programs, libraries do not have a main function. Therefore they cannot communicate directly with the outside world. This gives you the chance to write your own main function and call library functions from within it. After compiling your program into a binary executable, you just have to link it to the library and you are ready to run (execute) your program. In this way, you can use Gnuastro at a much lower-level, and in combination with other libraries on your system, you can significantly boost your creativity.

This chapter starts with a basic introduction to libraries and how you can use them in Review of library fundamentals. The separate functions in the Gnuastro library are then introduced (classified by context) in Gnuastro library. If you end up routinely using a fixed set of library functions, with a well-defined input and output, it will be much more beneficial if you define a program for the job. Therefore, in its Version controlled source, Gnuastro comes with the The TEMPLATE program to easily define your own programs(s).

Next: Developing, Previous: Makefile extensions (for GNU Make), Up: GNU Astronomy Utilities   [Contents][Index]