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

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

2013-12-22 Thread Jed Brown
Stefan Beller 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. With gcc, for example, y

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

2013-12-23 Thread Ravi Shekhar Jethani
2013/12/22 Jed Brown : > There is a difference for shared libraries if you would like to control > which symbols are exported. With gcc, for example, you might compile > using -fvisibility=hidden. Any functions explicitly declared with > extern, bearing __attribute__((visibility("default")), or u

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

2013-12-23 Thread Jed Brown
Ravi Shekhar Jethani 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 source > director