From a1521be58897173fb5608b7d53118add1969a9c3 Mon Sep 17 00:00:00 2001 From: Benjamin Reed Date: Fri, 25 Apr 2008 14:06:42 -0400 Subject: [PATCH] enable hidden visiblity of the wrap_* functions This patch enables setting the "hidden" attribute on the new wrap_* functions if -DENABLE_GCC_VISIBILITY is set when compiling. This will avoid adding new public symbols to the library so it should be safe as far as remaining binary-compatible. On the other hand, the rest of cairomm is not visibility-aware, so I enabled this as a hack you need to manually define for now. I'm not sure how best to go about properly testing for "real" visibility support and changing the rest of cairomm to take advantage of it. --- cairomm/context_private.h | 12 +++++++++--- cairomm/context_surface_quartz.cc | 2 +- cairomm/context_surface_win32.cc | 2 +- cairomm/context_surface_xlib.cc | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cairomm/context_private.h b/cairomm/context_private.h index 3081dca..9118d8f 100644 --- a/cairomm/context_private.h +++ b/cairomm/context_private.h @@ -19,6 +19,12 @@ #ifndef __CAIROMM_CONTEXT_PRIVATE_H #define __CAIROMM_CONTEXT_PRIVATE_H +#ifdef ENABLE_GCC_VISIBILITY + #define VISIBILITY_HIDDEN __attribute__ ((visibility("hidden"))) +#else + #define VISIBILITY_HIDDEN +#endif + #include #include @@ -28,9 +34,9 @@ namespace Cairo namespace Private { -RefPtr wrap_surface_quartz(cairo_surface_t*); -RefPtr wrap_surface_win32(cairo_surface_t*); -RefPtr wrap_surface_xlib(cairo_surface_t*); +VISIBILITY_HIDDEN RefPtr wrap_surface_quartz(cairo_surface_t*); +VISIBILITY_HIDDEN RefPtr wrap_surface_win32(cairo_surface_t*); +VISIBILITY_HIDDEN RefPtr wrap_surface_xlib(cairo_surface_t*); } // namespace Private diff --git a/cairomm/context_surface_quartz.cc b/cairomm/context_surface_quartz.cc index 540dca3..49de634 100644 --- a/cairomm/context_surface_quartz.cc +++ b/cairomm/context_surface_quartz.cc @@ -26,7 +26,7 @@ namespace Cairo namespace Private { -RefPtr wrap_surface_quartz(cairo_surface_t* surface) +VISIBILITY_HIDDEN RefPtr wrap_surface_quartz(cairo_surface_t* surface) { #if CAIRO_HAS_QUARTZ_SURFACE return RefPtr(new QuartzSurface(surface, false /* does not have reference */)); diff --git a/cairomm/context_surface_win32.cc b/cairomm/context_surface_win32.cc index 61837bd..13d13e7 100644 --- a/cairomm/context_surface_win32.cc +++ b/cairomm/context_surface_win32.cc @@ -26,7 +26,7 @@ namespace Cairo namespace Private { -RefPtr wrap_surface_win32(cairo_surface_t* surface) +VISIBILITY_HIDDEN RefPtr wrap_surface_win32(cairo_surface_t* surface) { #if CAIRO_HAS_WIN32_SURFACE return RefPtr(new Win32Surface(surface, false /* does not have reference */)); diff --git a/cairomm/context_surface_xlib.cc b/cairomm/context_surface_xlib.cc index 0f57bc7..a77e945 100644 --- a/cairomm/context_surface_xlib.cc +++ b/cairomm/context_surface_xlib.cc @@ -26,7 +26,7 @@ namespace Cairo namespace Private { -RefPtr wrap_surface_xlib(cairo_surface_t* surface) +VISIBILITY_HIDDEN RefPtr wrap_surface_xlib(cairo_surface_t* surface) { #if CAIRO_HAS_WIN32_SURFACE return RefPtr(new XlibSurface(surface, false /* does not have reference */)); -- 1.5.3.7