1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

symbols are now hidden unless explicitly exported by SCM_API

* libguile/__scm.h (SCM_API, SCM_INTERNAL): Take the reverse strategy: symbols will
  be hidden by default, and only exported with SCM_API. In addition to working
  on Mac OS, it has the several nice efficiency benefits on Linux, and unifies
  codepaths with Win32.

* libguile/Makefile.am: Define BUILDING_LIBGUILE when building Guile.
This commit is contained in:
Andy Wingo 2009-05-26 17:39:58 +02:00
parent d9a9e18205
commit 442f3f20dd
2 changed files with 13 additions and 15 deletions

View file

@ -32,10 +32,10 @@ DEFAULT_INCLUDES =
## Check for headers in $(srcdir)/.., so that #include ## Check for headers in $(srcdir)/.., so that #include
## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're ## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
## building. Also look for Gnulib headers in `lib'. ## building. Also look for Gnulib headers in `lib'.
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir) \ AM_CPPFLAGS = -DBUILDING_LIBGUILE=1 -I$(top_srcdir) -I$(top_builddir) \
-I$(top_srcdir)/lib -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_builddir)/lib
AM_CFLAGS = $(GCC_CFLAGS) AM_CFLAGS = $(GCC_CFLAGS) $(CFLAG_VISIBILITY)
## The Gnulib Libtool archive. ## The Gnulib Libtool archive.
gnulib_library = $(top_builddir)/lib/libgnu.la gnulib_library = $(top_builddir)/lib/libgnu.la

View file

@ -98,13 +98,10 @@
#define SCM_UNLIKELY(_expr) SCM_EXPECT ((_expr), 0) #define SCM_UNLIKELY(_expr) SCM_EXPECT ((_expr), 0)
/* The SCM_INTERNAL macro makes it possible to explicitly declare a function /* The SCM_INTERNAL macro makes it possible to explicitly declare a function
* as having "internal" linkage. */ * as having "internal" linkage. However our current tack on this problem is
#if (defined __GNUC__) && \ * to use GCC 4's -fvisibility=hidden, making functions internal by default,
((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ == 3)) * and then SCM_API marks them for export. */
# define SCM_INTERNAL extern __attribute__ ((__visibility__ ("internal"))) #define SCM_INTERNAL extern
#else
# define SCM_INTERNAL extern
#endif
@ -154,13 +151,14 @@
/* SCM_API is a macro prepended to all function and data definitions /* SCM_API is a macro prepended to all function and data definitions
which should be exported or imported in the resulting dynamic link which should be exported from libguile. */
library (DLL) in the Win32 port. */
#if defined (SCM_IMPORT) #if BUILDING_LIBGUILE && HAVE_VISIBILITY
# define SCM_API __declspec (dllimport) extern # define SCM_API extern __attribute__((__visibility__("default")))
#elif defined (SCM_EXPORT) || defined (DLL_EXPORT) #elif BUILDING_LIBGUILE && defined _MSC_VER
# define SCM_API __declspec (dllexport) extern # define SCM_API __declspec(dllexport) extern
#elif defined _MSC_VER
# define SCM_API __declspec(dllimport) extern
#else #else
# define SCM_API extern # define SCM_API extern
#endif #endif