git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
RJRavi Shekhar Jethani <rsjethani@gmail.com>
Date
Dec 23, 2013, 15:24 UTC
Message-ID
<CAKTJ_1z-pMePmh4phM2TXSMx0kOjGJ0afQ_JRESggi=k6+y-jA@mail.gmail.com>
In-Reply-To
<87eh54spw3.fsf@jedbrown.org>
2013/12/22 Jed Brown <jed@59a2.org>:
Show 11 quoted lines
> 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 using
> visibility pragmas will be exported (similar to __declspec(dllexport) on
> Windows).  Other functions will be internal to the shared library so you
> don't have to worry about callers depending on those symbols and
> performance can be a bit better by skipping the PLT and avoiding symbol
> relocations at load time.  See Drepper's guide for more.
>
> http://www.akkadia.org/drepper/dsohowto.pdf

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 directory..no matches. I am confused!!!.

Also I checked this: $ ldd git There is no 'gitish' .so in the output; it seems everything is packed inside one executable. So your second point 'skipping the PLT...' also doesn't seem to apply here.

Regards, Ravi Shekhar Jethani

Previous: Jed BrownNext: Jed Brown
Message 4 of 5 in “Rationale behind 'extern' on protypes in .h files”
  1. Ravi Shekhar JethaniDec 22, 2013
  2. Stefan BellerDec 22, 2013
  3. Jed BrownDec 22, 2013
  4. Ravi Shekhar JethaniDec 23, 2013
  5. Jed BrownDec 23, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.