How can I see the functions you can use with libraries, particularly math.h? I want to know how they do some stuff, but I can't find these functions anywhere in the libraries. Where can I look to learn some of these functions?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No I'd like to know several functions, not just a few. If there isn't an easy way of getting this onfo, that's okay. I was just curious about how some of the functions are done.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Take a moment and take a gander at the section in the thread titled "Please Read Before Posting a Question", on the Compile Log, Including Headers and Linking Libaries, it will get you started on understanding the difference beween a header and a library.
You do know by the way that a header (which describes the interface to the associated functions in the library), can be edited just like any text file.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2006-08-16
>> No I did not know that, when I googled math.h, one of the titles said "The Mathematics Library (math.h)...", but I guess they were wrong.
They were not 'wrong' as such - to say that would be somewhat pedantic - math.h is the header you need to include in your source code in order to use the standard math library. It contains declarations (i.e. prototypes) of the functions that are defined in the library. The compiler uses these declarations to check the calls you make, and places 'unresolved reference' in the code. The linker (which is a separate stage from compilation) then takes all your compiled object code and the library code and cross-references then to resolve these references with direct calls to the code.
The libraries themselves come in two forms - static libraries (or archives) which by convention in GNU have the .a extension (others generally use .lib), or Dynamic Link Libraries (.dll). DLLs generally have a small static library called an export library, which is linked with teh code to enable the DLL to be linked automatically at runtime.
>> Anyway, I'd like to know how they are actually implemented, such as sqr(x) => x*x.
These libraries are pre-compiled binary object code, so you cannot determine the source implementation by inspecting them. Moreover the standard C library implementation used by MinGW is Microsoft's MSVC++ C runtime (in MSVCRT.DLL). This is not open source code, so you cannot see how it was implemented.
However, if you want to simply see an implementation, there are a number of open source C libraries whose code you could inspect.
How can I see the functions you can use with libraries, particularly math.h? I want to know how they do some stuff, but I can't find these functions anywhere in the libraries. Where can I look to learn some of these functions?
Thank you Clifford, that's very helpful!
You understand that "math.h" is not a library, but rather a header?
Are you wanting to see how the functions are called, or how they are actually implimented?
Wayne
No I did not know that, when I googled math.h, one of the titles said "The Mathematics Library (math.h)...", but I guess they were wrong.
Anyway, I'd like to know how they are actually implemented, such as sqr(x) => x*x.
x*x=pow(x,2)
No I'd like to know several functions, not just a few. If there isn't an easy way of getting this onfo, that's okay. I was just curious about how some of the functions are done.
Take a moment and take a gander at the section in the thread titled "Please Read Before Posting a Question", on the Compile Log, Including Headers and Linking Libaries, it will get you started on understanding the difference beween a header and a library.
You do know by the way that a header (which describes the interface to the associated functions in the library), can be edited just like any text file.
Wayne
>> No I did not know that, when I googled math.h, one of the titles said "The Mathematics Library (math.h)...", but I guess they were wrong.
They were not 'wrong' as such - to say that would be somewhat pedantic - math.h is the header you need to include in your source code in order to use the standard math library. It contains declarations (i.e. prototypes) of the functions that are defined in the library. The compiler uses these declarations to check the calls you make, and places 'unresolved reference' in the code. The linker (which is a separate stage from compilation) then takes all your compiled object code and the library code and cross-references then to resolve these references with direct calls to the code.
The libraries themselves come in two forms - static libraries (or archives) which by convention in GNU have the .a extension (others generally use .lib), or Dynamic Link Libraries (.dll). DLLs generally have a small static library called an export library, which is linked with teh code to enable the DLL to be linked automatically at runtime.
>> Anyway, I'd like to know how they are actually implemented, such as sqr(x) => x*x.
These libraries are pre-compiled binary object code, so you cannot determine the source implementation by inspecting them. Moreover the standard C library implementation used by MinGW is Microsoft's MSVC++ C runtime (in MSVCRT.DLL). This is not open source code, so you cannot see how it was implemented.
However, if you want to simply see an implementation, there are a number of open source C libraries whose code you could inspect.
GNU C library: http://www.gnu.org/software/libc/
Newlib C library: http://sources.redhat.com/newlib/
Clifford