[Ns-developers] GCC 4 -fvisibility=hidden

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Tue Jan 27 00:01:11 PST 2009


On Sun, 2009-01-25 at 19:51 +0000, Gustavo Carneiro wrote:

>         
>         It's been a while since I did not look at this, so how do they
>         do it ?
> 
> They generate gtkalias.h and gtkaliasdef.c from gtk.symbols.
> 
> gtk.symbols contains:
> [...]
> gtk_window_unfullscreen
> [...]
> 
> gtkalias.h contains:
> [...]
> extern __typeof (gtk_window_unfullscreen) IA__gtk_window_unfullscreen
> __attribute((visibility("hidden")));
> #define gtk_window_unfullscreen IA__gtk_window_unfullscreen
> [...]
> 
> gtkaliasdef.c contains:
> [...]
> #undef gtk_window_unfullscreen 
> extern __typeof (gtk_window_unfullscreen) gtk_window_unfullscreen
> __attribute((alias("IA__gtk_window_unfullscreen"),
> visibility("default")));
> [...]
> 
> gtkwindow.c contains:
> [...]
> #include "gtkalias.h"
> [...]
> void
> gtk_window_unfullscreen (GtkWindow *window)
> {
> [...]
> 
> The gtk_window_unfullscreen definition in gtkwindow.c expands (because
> of a #define) to IA__gtk_window_unfullscreen, which was previously
> declared with hidden visibility.  gtkaliasdef.c provides an alias
> symbol to IA__gtk_window_unfullscreen called gtk_window_unfullscreen
> with public visibility.  But internally gtk+'s own code only ends up
> calling the functions with private visibility and no GOT lookups.

Ah, ok, now, I remember why I gave up on this last time: I could not
figure out the C++ equivalent of the above. Namely, how we could do this
for C++ methods and classes. As far as I can tell, there is no way to do
this for C++.

Mathieu




More information about the Ns-developers mailing list