Results 1 to 2 of 2
I thought I'd increase my knowledge of compilation and linking technologies, so I thought I'd ask you all this question. When I declare a function in C, how does the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-25-2006 #1
How does the C compiler find function definitions?
I thought I'd increase my knowledge of compilation and linking technologies, so I thought I'd ask you all this question. When I declare a function in C, how does the compiler/linker know where to find the definition. For example, if I declare a function with the same parameters and return value as free(), and I don't implement it, will the compiler use free declared in stdlib, or will it complain because I didn't include it?
Thanks!Flies of a particular kind, i.e. time-flies, are fond of an arrow.
Registered Linux User #408794
- 02-26-2006 #2Just Joined!
- Join Date
- Oct 2005
- Location
- Mass
- Posts
- 52
c programming 101:
if you declare it as
somewhere and decide toCode:void free(void *);
elsewhere without implementation then you'll have an errorCode:free(ptr);
however if you try to
and link with c standard libraries then it will use stdlib freeCode:extern void free(void *);
if you
then you'll have an errorCode:#include "stdlib.h" void free(void *);


Reply With Quote
