I am currently learning the more intricacies of C and have a question that I am not positive on.
I am developing on Linux platforms and am slightly confused on the mechanics of how the linker actually works. If you could answer these few questions it would help me out a lot.
You obviously have to include relevant .h files for the compiler to do syntax checking, etc, but how does does the linker know which library to pull the symbol from? For instance, if I make a call to strcpy how would the linker actually traverse the library folder to find this? Or would it just go directly to libc?
My latest program is using a decent amount of encryption functions so I am using openssl to do so; when making calls to these functions I was receiving an error that the functions didn't exist until I gave a -lssl flag on gcc to include libssl. I am assuming that by default the linker will only use functions from libc and all user created libraries must be explicitly stated, even if in the same directory? Or am I missing something?
Lastly, what happens if I have a function with the same name and signature as a previous function. How does the linker decide between the two? First it encounters? Or does it simply throw an error? Or a warning?
Anyways, thanks for all your help in advance!