Control symbol exports using -fvisibility

On systems using GCC 4.0 or newer which support symbol visibility in shared
libraries, use -fvisibility=hidden and only export explict API functions
defined in zmq.cpp. We do not enable -fvisibility on MinGW since this uses a
separate mechanism (__declspec).

Signed-off-by: Martin Lucina <mato@kotelna.sk>
This commit is contained in:
Martin Lucina
2010-11-25 17:12:31 +01:00
committed by Martin Sustrik
parent 734624be76
commit c9584096e0
5 changed files with 35 additions and 2 deletions

View File

@@ -39,6 +39,9 @@ extern "C" {
# endif
#else
# define ZMQ_EXPORT
# if defined __GNUC__ && __GNUC__ >= 4
# pragma GCC visibility push(default)
# endif
#endif
/******************************************************************************/
@@ -242,6 +245,11 @@ ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout);
ZMQ_EXPORT int zmq_device (int device, void * insocket, void* outsocket);
#undef ZMQ_EXPORT
#if defined __GNUC__ && __GNUC__ >= 4 && !defined _WIN32
# pragma GCC visibility pop
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -33,6 +33,9 @@ extern "C" {
# endif
#else
# define ZMQ_EXPORT
# if defined __GNUC__ && __GNUC__ >= 4
# pragma GCC visibility push(default)
# endif
#endif
/* Helper functions are used by perf tests so that they don't have to care */
@@ -49,6 +52,9 @@ ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_);
ZMQ_EXPORT void zmq_sleep (int seconds_);
#undef ZMQ_EXPORT
#if defined __GNUC__ && __GNUC__ >= 4 && !defined _WIN32
# pragma GCC visibility pop
#endif
#ifdef __cplusplus
}