[PATCH 2/2] Use lib-symbol-visibility for the C++ library
Boyan Kasarov
bkasarov at gmail.com
Sat Oct 17 16:42:35 CEST 2009
---
lib/Makefile.am | 5 +++-
lib/includes/gnutls/gnutlsxx.h | 46 ++++++++++++++++++++++++---------------
lib/libgnutlsxx.map | 2 -
3 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 350a087..ab4ddb4 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -141,7 +141,10 @@ endif
# C++ library
if ENABLE_CXX
-libgnutlsxx_la_CPPFLAGS = -I$(top_srcdir)/includes -I$(top_builddir)/includes
+libgnutlsxx_la_CPPFLAGS = -DBUILDING_GNUTLSXX \
+ $(CFLAG_VISIBILITY) \
+ -I$(top_srcdir)/includes \
+ -I$(top_builddir)/includes
AM_CXXFLAGS = -I$(top_srcdir)/includes/
diff --git a/lib/includes/gnutls/gnutlsxx.h b/lib/includes/gnutls/gnutlsxx.h
index b3013d2..f331b45 100644
--- a/lib/includes/gnutls/gnutlsxx.h
+++ b/lib/includes/gnutls/gnutlsxx.h
@@ -5,10 +5,20 @@
#include <vector>
#include <gnutls/gnutls.h>
+#if BUILDING_GNUTLSXX && HAVE_VISIBILITY
+#define GNUTLSXX_DLL_EXPORTED __attribute__((__visibility__("default")))
+#elif BUILDING_GNUTLSXX && defined _MSC_VER
+#define GNUTLSXX_DLL_EXPORTED __declspec(dllexport)
+#elif defined _MSC_VER
+#define GNUTLSXX_DLL_EXPORTED __declspec(dllimport)
+#else
+#define GNUTLSXX_DLL_EXPORTED
+#endif
+
namespace gnutls
{
- class noncopyable
+ class GNUTLSXX_DLL_EXPORTED noncopyable
{
protected:
noncopyable ()
@@ -25,7 +35,7 @@ namespace gnutls
};
- class exception:public std::exception
+ class GNUTLSXX_DLL_EXPORTED exception:public std::exception
{
public:
exception (int x);
@@ -36,7 +46,7 @@ namespace gnutls
};
- class dh_params:private noncopyable
+ class GNUTLSXX_DLL_EXPORTED dh_params:private noncopyable
{
public:
dh_params ();
@@ -58,7 +68,7 @@ namespace gnutls
};
- class rsa_params:private noncopyable
+ class GNUTLSXX_DLL_EXPORTED rsa_params:private noncopyable
{
public:
rsa_params ();
@@ -84,7 +94,7 @@ namespace gnutls
gnutls_rsa_params_t params;
};
- class session:private noncopyable
+ class GNUTLSXX_DLL_EXPORTED session:private noncopyable
{
protected:
gnutls_session_t s;
@@ -204,7 +214,7 @@ namespace gnutls
};
// interface for databases
- class DB:private noncopyable
+ class GNUTLSXX_DLL_EXPORTED DB:private noncopyable
{
public:
virtual ~ DB () = 0;
@@ -215,7 +225,7 @@ namespace gnutls
virtual bool remove (const gnutls_datum_t & key) = 0;
};
- class server_session:public session
+ class GNUTLSXX_DLL_EXPORTED server_session:public session
{
public:
server_session ();
@@ -239,7 +249,7 @@ namespace gnutls
void set_certificate_request (gnutls_certificate_request_t);
};
- class client_session:public session
+ class GNUTLSXX_DLL_EXPORTED client_session:public session
{
public:
client_session ();
@@ -252,7 +262,7 @@ namespace gnutls
};
- class credentials:private noncopyable
+ class GNUTLSXX_DLL_EXPORTED credentials:private noncopyable
{
public:
virtual ~ credentials ()
@@ -269,7 +279,7 @@ namespace gnutls
void *cred;
};
- class certificate_credentials:public credentials
+ class GNUTLSXX_DLL_EXPORTED certificate_credentials:public credentials
{
public:
~certificate_credentials ();
@@ -314,7 +324,7 @@ namespace gnutls
gnutls_certificate_credentials_t cred;
};
- class certificate_server_credentials:public certificate_credentials
+ class GNUTLSXX_DLL_EXPORTED certificate_server_credentials:public certificate_credentials
{
public:
void set_retrieve_function (gnutls_certificate_server_retrieve_function *
@@ -322,7 +332,7 @@ namespace gnutls
void set_params_function (gnutls_params_function * func);
};
- class certificate_client_credentials:public certificate_credentials
+ class GNUTLSXX_DLL_EXPORTED certificate_client_credentials:public certificate_credentials
{
public:
void set_retrieve_function (gnutls_certificate_client_retrieve_function *
@@ -332,7 +342,7 @@ namespace gnutls
- class anon_server_credentials:public credentials
+ class GNUTLSXX_DLL_EXPORTED anon_server_credentials:public credentials
{
public:
anon_server_credentials ();
@@ -343,7 +353,7 @@ namespace gnutls
gnutls_anon_server_credentials_t cred;
};
- class anon_client_credentials:public credentials
+ class GNUTLSXX_DLL_EXPORTED anon_client_credentials:public credentials
{
public:
anon_client_credentials ();
@@ -353,7 +363,7 @@ namespace gnutls
};
- class srp_server_credentials:public credentials
+ class GNUTLSXX_DLL_EXPORTED srp_server_credentials:public credentials
{
public:
srp_server_credentials ();
@@ -366,7 +376,7 @@ namespace gnutls
gnutls_srp_server_credentials_t cred;
};
- class srp_client_credentials:public credentials
+ class GNUTLSXX_DLL_EXPORTED srp_client_credentials:public credentials
{
public:
srp_client_credentials ();
@@ -379,7 +389,7 @@ namespace gnutls
};
- class psk_server_credentials:public credentials
+ class GNUTLSXX_DLL_EXPORTED psk_server_credentials:public credentials
{
public:
psk_server_credentials ();
@@ -393,7 +403,7 @@ namespace gnutls
gnutls_psk_server_credentials_t cred;
};
- class psk_client_credentials:public credentials
+ class GNUTLSXX_DLL_EXPORTED psk_client_credentials:public credentials
{
public:
psk_client_credentials ();
diff --git a/lib/libgnutlsxx.map b/lib/libgnutlsxx.map
index f61d861..8ced950 100644
--- a/lib/libgnutlsxx.map
+++ b/lib/libgnutlsxx.map
@@ -36,6 +36,4 @@ GNUTLS_1_6
*gnutls::*;
};
-
- local: *;
};
--
1.6.4.4
More information about the Gnutls-devel
mailing list