Gnuastro’s libraries are written in the C programming language. In Why C programming language?, we have thoroughly discussed the reasons behind this choice. C was actually created to write Unix, thus understanding the way C works can greatly help in effectively using programs and libraries in all Unix-like operating systems. Therefore, in the following subsections some important aspects of C, as it relates to libraries (and thus programs that depend on them) on Unix are reviewed. First we will discuss header files in Headers and then go onto Linking. This section finishes with Summary and example on libraries. If you are already familiar with these concepts, please skip this section and go directly to Gnuastro library.
In theory, a full operating system (or any software) can be written as one function. Such a software would not need any headers or linking (that are discussed in the subsections below). However, writing that single function and maintaining it (adding new features, fixing bugs, documentation and etc) would be a programmer or scientist’s worst nightmare! Furthermore, all the hard work that went into creating it cannot be reused in other software: every other programmer or scientist would have to re-invent the wheel. The ultimate purpose behind libraries (which come with headers and have to be linked) is to address this problem and increase modularity: “the degree to which a system’s components may be separated and recombined” (from Wikipedia). The more modular the source code of a program or library, the easier maintaining it will be, and all the hard work that went into creating it can be reused for a wider range of problems.
|• Headers:||Header files included in source.|
|• Linking:||Linking the compiled source files into one.|
|• Summary and example on libraries:||A summary and example on using libraries.|