public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: Max Sagebaum <max.sagebaum@scicomp.uni-kl.de>
Cc: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: Detect '-fvisibility=hidden' during pre process or compile time
Date: Fri, 22 Apr 2022 19:44:13 +0300 (MSK)	[thread overview]
Message-ID: <879387da-db54-226-9bab-25fe98d14e40@ispras.ru> (raw)
In-Reply-To: <4fc5fa2b65c0f9f16a304250c6a41604485f0650.camel@scicomp.uni-kl.de>



On Fri, 22 Apr 2022, Max Sagebaum wrote:

> Hello Alexander,
> 
> thank you for the answer. Unfortunately, the type needs to be a template
> parameter.  Is there any other way to change the visibility of a member or in
> addition change the visibility of a template parameter?

You can change visibility of the type used as the template parameter; in the
small example in the Bugzilla, you could write

struct __attribute__((visibility("default"))) S {
};

or with a pragma:

#pragma GCC visibility push(default)
struct S {
};
#pragma GCC visibility pop

If in your actual library such 'struct S' has many members and you want to avoid
making them default-visibility, you could move some of them into a subobject
(which then may have hidden visibility).

Alexander

      reply	other threads:[~2022-04-22 16:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22 12:48 Max Sagebaum
2022-04-22 15:09 ` Alexander Monakov
2022-04-22 16:16   ` Max Sagebaum
2022-04-22 16:44     ` Alexander Monakov [this message]

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=879387da-db54-226-9bab-25fe98d14e40@ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=gcc-help@gcc.gnu.org \
    --cc=max.sagebaum@scicomp.uni-kl.de \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).