I'm somewhat new to linux. Recently I've been doing a bunch of c linux development. I was just debugging a segmentation fault. Unfortunately I hadn't used the gcc debugger as I guess I was lucky and most of the bugs I ran into where pretty easy to solve without a debugger. The most recent one was more difficult. I was getting a segmentation fault. All the printf's I put in were telling me it was faulting in a curl function I was using.
At this point it seemed I needed to use the debugger. To get to the point, it turned out that curl was calling my send() function. Of course my send() function wasn't expecting to be called by curl and thus I can see why I was getting a segmentation fault. So my question is, why when I linked with curl was the curl code calling my send() function instead of calling the curl send() function? I'm guessing the curl library has a send() function and for some reason my send() function was being used instead. I'm not all that familiar with how a linker works, but I assume it needs to resolve all the called methods. Thus when the curl library was linked it should have had to resolve all the called methods. The call to send() should have resolved to the send() method in the curl code. I was able to fix the problem by changing my send() function to my_send().
I'm using gcc to compile my c source files. Is this a bug? If not, is there some way to know that duplicate symbols where found so that I know when some of my function names are colliding with the libraries I'm linking with?
Thanks, Nick