From: Jed Brown <jed@59A2.org>
To: Stefan Beller <stefanbeller@googlemail.com>,
Ravi Shekhar Jethani <rsjethani@gmail.com>,
git@vger.kernel.org
Subject: Re: Rationale behind 'extern' on protypes in .h files
Date: Sun, 22 Dec 2013 11:26:52 -0700 [thread overview]
Message-ID: <87eh54spw3.fsf@jedbrown.org> (raw)
In-Reply-To: <52B71D24.4000207@googlemail.com>
[-- Attachment #1: Type: text/plain, Size: 861 bytes --]
Stefan Beller <stefanbeller@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. 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
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
next prev parent reply other threads:[~2013-12-22 18:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-22 15:51 Rationale behind 'extern' on protypes in .h files Ravi Shekhar Jethani
2013-12-22 17:11 ` Stefan Beller
2013-12-22 18:26 ` Jed Brown [this message]
2013-12-23 15:24 ` Ravi Shekhar Jethani
2013-12-23 16:59 ` Jed Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eh54spw3.fsf@jedbrown.org \
--to=jed@59a2.org \
--cc=git@vger.kernel.org \
--cc=rsjethani@gmail.com \
--cc=stefanbeller@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).