Index: configure.in
===================================================================
--- configure.in	(revision 9288)
+++ configure.in	(working copy)
@@ -146,6 +146,35 @@
     APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
 fi
 
+# gcc visibility
+AC_ARG_ENABLE([gcc-visibility],
+	[AC_HELP_STRING([--disable-gcc-visibility], [Do not use the gcc >= 4.0 visibility support])],
+	[enable_gcc_visibility="$enableval"],
+	[enable_gcc_visibility="yes"]
+)
+if test "x${enable_gcc_visibility}" != "xno" && \
+   test "x${ax_cv_c_compiler_vendor}" = "xgnu"
+then
+	save_CFLAGS="${CFLAGS}"
+	CFLAGS="${CFLAGS} -fvisibility=hidden"
+	AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
+	AC_COMPILE_IFELSE(
+		[AC_LANG_PROGRAM(
+			[int foo __attribute__ ((visibility("default")));],
+			[;]
+		)],
+
+		[AC_MSG_RESULT([yes])
+		 AC_DEFINE([HAVE_GCC_VISIBILITY],[1],[GCC visibility support])
+		 GCC_VISIBILITY="yes"
+		 APR_ADDTO([SWITCH_AM_CFLAGS], [-fvisibility=hidden -DHAVE_GCC_VISIBILITY=1])],
+
+		[AC_MSG_RESULT([no])
+		 GCC_VISIBILITY="no"]
+	)
+	CFLAGS="${save_CFLAGS}"
+fi
+
 # Enable debugging (default: on)
 # (rename option if the default is changed)
 AC_ARG_ENABLE(debug,
Index: src/include/switch_platform.h
===================================================================
--- src/include/switch_platform.h	(revision 9288)
+++ src/include/switch_platform.h	(working copy)
@@ -164,11 +164,19 @@
 #define SWITCH_THREAD_FUNC  __stdcall
 #else //not win32
 #define O_BINARY 0
-#define SWITCH_DECLARE(type) type
-#define SWITCH_DECLARE_NONSTD(type) type
-#define SWITCH_MOD_DECLARE(type) type
+#if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY)
+#define SWITCH_DECLARE(type)		__attribute__((visibility("default"))) type
+#define SWITCH_DECLARE_NONSTD(type)	__attribute__((visibility("default"))) type
+#define SWITCH_DECLARE_DATA		__attribute__((visibility("default")))
+#define SWITCH_MOD_DECLARE(type)	__attribute__((visibility("default"))) type
+#define SWITCH_MOD_DECLARE_DATA		__attribute__((visibility("default")))
+#else
+#define SWITCH_DECLARE(type)		type
+#define SWITCH_DECLARE_NONSTD(type)	type
 #define SWITCH_DECLARE_DATA
+#define SWITCH_MOD_DECLARE(type)	type
 #define SWITCH_MOD_DECLARE_DATA
+#endif
 #define SWITCH_THREAD_FUNC
 #endif
 #define SWITCH_DECLARE_CONSTRUCTOR SWITCH_DECLARE_DATA
Index: libs/libteletone/configure.in
===================================================================
--- libs/libteletone/configure.in	(revision 9288)
+++ libs/libteletone/configure.in	(working copy)
@@ -7,11 +7,16 @@
 AM_INIT_AUTOMAKE(libteletone,0.1)
 AC_CONFIG_SRCDIR([src])
 
+# disable checks
+m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
+m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
+
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_MAKE_SET
 AC_PROG_LIBTOOL
 AC_PROG_INSTALL
+
 #  Optimize
 AC_ARG_ENABLE(optimization,
 [AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
@@ -64,6 +69,36 @@
                 new_AM_LDFLAGS=""
         ;;
 esac
+
+# gcc visibility
+AC_ARG_ENABLE([gcc-visibility],
+	[AC_HELP_STRING([--disable-gcc-visibility], [Do not use the gcc (>=4.0) visibility support])],
+	[enable_gcc_visibility="$enableval"],
+	[enable_gcc_visibility="yes"]
+)
+if test "x${enable_gcc_visibility}" != "xno" && \
+   test "x${ax_cv_c_compiler_vendor}" = "xgnu"
+then
+	save_CFLAGS="${CFLAGS}"
+	CFLAGS="${CFLAGS} -fvisibility=hidden"
+	AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
+	AC_COMPILE_IFELSE(
+		[AC_LANG_PROGRAM(
+			[int foo __attribute__ ((visibility("default")));],
+			[;]
+		)],
+
+		[AC_MSG_RESULT([yes])
+		 AC_DEFINE([HAVE_GCC_VISIBILITY],[1],[GCC visibility support])
+		 GCC_VISIBILITY="yes"
+		 new_AM_CFLAGS="${new_AM_CFLAGS} -fvisibility=hidden"],
+
+		[AC_MSG_RESULT([no])
+		 GCC_VISIBILITY="no"]
+	)
+	CFLAGS="${save_CFLAGS}"
+fi
+
 AC_SUBST(new_AM_CFLAGS)
 AC_SUBST(new_AM_LDFLAGS)
 
Index: libs/libteletone/src/libteletone.h
===================================================================
--- libs/libteletone/src/libteletone.h	(revision 9288)
+++ libs/libteletone/src/libteletone.h	(working copy)
@@ -110,6 +110,12 @@
 #define teletone_assert(expr) assert(expr)
 #endif
 
+#ifdef HAVE_GCC_VISIBILITY
+#define TELETONE_API __attribute__((visibility("default")))
+#else
+#define TELETONE_API
+#endif
+
 #include <libteletone_generate.h>
 #include <libteletone_detect.h>
 
Index: libs/libteletone/src/libteletone_detect.c
===================================================================
--- libs/libteletone/src/libteletone_detect.c	(revision 9288)
+++ libs/libteletone/src/libteletone_detect.c	(working copy)
@@ -116,7 +116,7 @@
 	goertzel_state->fac = tdesc->fac;
 }
 
-void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
+TELETONE_API void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
 							  int16_t sample_buffer[],
 							  int samples)
 {
@@ -135,7 +135,7 @@
 
 #define teletone_goertzel_result(gs) (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac))
 
-void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
+TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
 {
 	int i;
 	float theta;
@@ -169,7 +169,7 @@
 	dtmf_detect_state->mhit = 0;
 }
 
-void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
+TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
 {
 	float theta = 0;
 	int x = 0;
@@ -207,7 +207,7 @@
 
 }
 
-int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
+TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
 								int16_t sample_buffer[],
 								int samples)
 {
@@ -297,7 +297,7 @@
 }
 
 
-int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
 						  int16_t sample_buffer[],
 						  int samples)
 {
@@ -428,7 +428,7 @@
 }
 
 
-int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
 					   char *buf,
 					   int max)
 {
Index: libs/libteletone/src/libteletone_generate.c
===================================================================
--- libs/libteletone/src/libteletone_generate.c	(revision 9288)
+++ libs/libteletone/src/libteletone_generate.c	(working copy)
@@ -99,7 +99,7 @@
 };
 
 
-int teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
+TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
 {
 	va_list ap;
 	int i = 0;
@@ -115,7 +115,7 @@
 	
 }
 
-int teletone_set_map(teletone_tone_map_t *map, ...)
+TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...)
 {
 	va_list ap;
 	int i = 0;
@@ -131,7 +131,7 @@
 	
 }
 
-int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
+TELETONE_API int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
 {
 	memset(ts, 0, sizeof(*ts));
 	ts->rate = 8000;
@@ -174,7 +174,7 @@
 	return 0;
 }
 
-int teletone_destroy_session(teletone_generation_session_t *ts)
+TELETONE_API int teletone_destroy_session(teletone_generation_session_t *ts)
 {
 	if (ts->buffer) {
 		free(ts->buffer);
@@ -203,7 +203,7 @@
 	return 0;
 }
 
-int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
+TELETONE_API int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
 {
 	/*teletone_process_t period = (1.0 / ts->rate) / ts->channels;*/
 	int i, c;
@@ -318,7 +318,7 @@
 	return (char *) memcpy (new, s, len);
 }
 
-int teletone_run(teletone_generation_session_t *ts, const char *cmd)
+TELETONE_API int teletone_run(teletone_generation_session_t *ts, const char *cmd)
 {
 	char *data = NULL, *cur = NULL, *end = NULL;
 	int var = 0, LOOPING = 0;
