How it works?

I have a question about the implementation&interface in different free libraries, such as GNU Scientific Library. But this is just a common question, not concerned about this particular package.

I'm using the example from the official GNU web site: http://www.gnu.org/software/gsl/manual/html_node/An-Example-Program.html#An-Example-Program
1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>
#include <gsl/gsl_sf_bessel.h>

int
main (void)
{
  double x = 5.0;
  double y = gsl_sf_bessel_J0 (x);
  printf ("J0(%g) = %.18e\n", x, y);
  return 0;
}


And everything works fine...

But my question here is about implementation: I looked into gsl_sf_bessel.h header file and there is only function prototypes here (for example for our function: double gsl_sf_bessel_J0(const double x);), and that's it. No implementation...

Is it possible to see the implementation (is there gsl_sf_bessel.cpp files for example?). And if it's not: How it works?
How could we use only header files (interface) to use those functions? Where the system gets the information about the interface of this function?
Last edited on
I'm feeling, that probably it's somehow related to the libraries, which also installed when I did the installation of GNU Scientific, but I'm not sure...
So, is it only header files and implementaion is somewhere else (like in some dynamic library where I can't see the implementation)? So I can't change the implementation if I wanted to, for example, but only use as-is, right?..
The implementations are in normal .c files just like usually, there just does not exists file "gsl_sf_bessel.c" exactly. The implementation of your example function "gsl_sf_bessel_J0" for example is found in file "bessel_J0.c". I can say from the specific header file that the implementations of its content are divided to quite a few source files but almost all of their names start with "bessel_" so they are not exactly hard to find even by manually searching. The files in question are in the "specfunc" folder if you want to take a look.
Last edited on
Most of the time, the implementations are housed in static-libraries (.a or .lib extensions), or in dynamic (link) libraries (also known as .dll).
Topic archived. No new replies allowed.