Re: Rationale behind 'extern' on protypes in .h files

2013-12-23 Thread Jed Brown
Ravi Shekhar Jethani rsjeth...@gmail.com writes: To check this I installed the libgit2-dev package which installed: /usr/include/git2/*.h , /usr/lib/libgit2.so Now, I exported all symbols using: $ readelf -s /usr/lib/libgit2.so and tried to match these with 'externed' prototypes in the Git

Rationale behind 'extern' on protypes in .h files

2013-12-22 Thread Ravi Shekhar Jethani
Hi, I am a C Data Structure teacher at at an institute. Up until now I have only written classroom type C code. I always had interest in operating systems especially Linux Kernel but never got into anything just passively followed 'lwn.net', 'dr dobbs magazine' etc. But the series '30 Linux

Re: Rationale behind 'extern' on protypes in .h files

2013-12-22 Thread Stefan Beller
On 22.12.2013 16:51, Ravi Shekhar Jethani wrote: Now, my real question : 1) I cannot understand the reason behind making function prototypes as extern. What purpose does this serve? AFAIK we put definition in a .c file and the prototype in a .h thats it. 2) Why are some prototypes in

Re: Rationale behind 'extern' on protypes in .h files

2013-12-22 Thread Jed Brown
Stefan Beller stefanbel...@googlemail.com writes: From my understanding there is no difference for functions declarations being set to extern or not, because extern is the default on functions. There is a difference for shared libraries if you would like to control which symbols are exported.