Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide private symbols (issue #33). #34

Merged
merged 1 commit into from
May 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions caca/caca.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
# define __extern extern __declspec(dllexport)
#elif defined _WIN32 && !defined __LIBCACA__ && !defined CACA_STATIC
# define __extern extern __declspec(dllimport)
#elif defined CACA_ENABLE_VISIBILITY
# define __extern extern __attribute__((visibility("default")))
#else
# define __extern extern
#endif
Expand Down
2 changes: 2 additions & 0 deletions caca/caca0.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# define __extern extern __declspec(dllexport)
#elif defined _WIN32 && !defined __LIBCACA__
# define __extern extern __declspec(dllimport)
#elif defined CACA_ENABLE_VISIBILITY
# define __extern extern __attribute__((visibility("default")))
#else
# define __extern extern
#endif
Expand Down
10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,16 @@ CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
CXXFLAGS="${CXXFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wsign-compare"

dnl Visibility annotations...
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden -Wall -Werror"
AC_MSG_CHECKING(whether compiler supports visibility annotations)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[void __attribute__((visibility("default"))) foo(void); void foo(void) {}]])],
[CFLAGS="$saved_CFLAGS -fvisibility=hidden -DCACA_ENABLE_VISIBILITY";
AC_MSG_RESULT(yes)],
[CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT(no)])

CACA_BINDINGS=""

# Build the C++ bindings?
Expand Down
2 changes: 2 additions & 0 deletions cxx/caca++.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#undef __class
#if defined(_WIN32) && defined(__LIBCACA_PP__)
# define __class class __declspec(dllexport)
#elif defined CACA_ENABLE_VISIBILITY
# define __class class __attribute__((visibility("default")))
#else
# define __class class
#endif
Expand Down