How is a library called?

Hi. I'm trying to convert a certain amount of data and I need to use a library to do that. I don't know how library functions can be called and I was not able to find much info on the issue, probably because I am not phrasing the question right.

Specifically, I want to use astro/libnova to find past date sunrise/sunset times and here is a good example of how to use the library. Unfortunately, I don't know how I would execute this program? Is it in C/C++? If it is C, do I start it with $ gcc <script>?

I assume that this is how a function in the library is called?
Code:
#include <libnova/rise_set.h>

If it is, how do I find which syntax to use for each function in the library? Generally there is no man page for libraries, so how can I query the library and ask the function list?

Thanks for any help.
 
Well, I got around to partially figuring out how to get a list of library functions:
$ nm -D /usr/local/lib/libnova.so
at least gives a list (even if not the parameters and call methods of the functions).
 
Save the contents of that example file to lunar.c

and then run...

Code:
$ gcc -o lunar -I/usr/local/include lunar.c -L/usr/local/lib -lnova

Code:
-o (output executable name)
-I (tell the compiler where header (.h) files are found)
-L (tell the compiler (linker) where the library (.so, .a) files are found)
-l (tell the compiler which library to link with the program)

Now you will have the program compiled as lunar

So just run...

Code:
$ ./lunar
 
Holy C code Batman!!

That really helps me immensely. Thank you!

When trying to answer your post I found the documentation for libnova and an example c code for solar calculations.
In case any one wanders on to this thread, sample codes are in the documentation tarball here. That document also answers my question on how to code for sunrise /sunset.

I only have one question left now: is it possible to feed a data file (of dates) to the code and get a file of "answers"?
 
Back
Top