From 43182b501b317603e02d538d89599ca9d1ac785e Mon Sep 17 00:00:00 2001
From: Dan Goodliffe <dan@randomdan.homeip.net>
Date: Sun, 24 Jan 2016 21:09:32 +0000
Subject: Partially tested global visibility hidden in all projects

---
 Jamroot.jam                 | 8 ++++----
 slicer/db/Jamfile.jam       | 1 -
 slicer/json/Jamfile.jam     | 1 -
 slicer/slicer/Jamfile.jam   | 1 -
 slicer/slicer/parser.cpp    | 4 ++--
 slicer/test/conversions.cpp | 8 ++++++++
 slicer/test/conversions.h   | 3 +++
 slicer/test/fileStructure.h | 3 ++-
 slicer/test/helpers.h       | 5 +++++
 slicer/tool/Jamfile.jam     | 1 -
 slicer/xml/Jamfile.jam      | 1 -
 11 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/Jamroot.jam b/Jamroot.jam
index cc16698..f42f929 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -8,13 +8,13 @@ variant coverage : debug ;
 
 project
   : requirements
-      <variant>release:<cflags>"-std=c++1y"
+      <variant>release:<cflags>"-std=c++1y -fvisibility=hidden"
       <variant>release:<linkflags>"-Wl,-z,defs,--warn-once,--gc-sections"
-      <variant>debug:<cflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y"
+      <variant>debug:<cflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y -fvisibility=hidden"
       <variant>debug:<linkflags>"-Wl,-z,defs,--warn-once"
-      <variant>coverage:<cflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y --coverage"
+      <variant>coverage:<cflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y --coverage -fvisibility=hidden"
       <variant>coverage:<linkflags>"-Wl,-z,defs,--warn-once --coverage"
-      <variant>component:<cflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y -fPIC"
+      <variant>component:<cflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y -fPIC -fvisibility=hidden"
 			<variant>component:<linkflags>"-Wl,-z,lazy,--warn-once,-fPIC"
 	;
 
diff --git a/slicer/db/Jamfile.jam b/slicer/db/Jamfile.jam
index 6c81c4d..664b6b1 100644
--- a/slicer/db/Jamfile.jam
+++ b/slicer/db/Jamfile.jam
@@ -17,7 +17,6 @@ lib slicer-db :
 	<library>../..//glibmm
 	<library>adhocutil
 	<library>../slicer//slicer
-	<cflags>-fvisibility=hidden
 	: :
 	<library>dbppcore
 	;
diff --git a/slicer/json/Jamfile.jam b/slicer/json/Jamfile.jam
index f99e4ab..240942a 100644
--- a/slicer/json/Jamfile.jam
+++ b/slicer/json/Jamfile.jam
@@ -21,7 +21,6 @@ lib slicer-json :
 	<library>../..//glibmm
 	<library>adhocutil
 	<library>../slicer//slicer
-	<cflags>-fvisibility=hidden
 	: :
 	<library>jsonpp
 	;
diff --git a/slicer/slicer/Jamfile.jam b/slicer/slicer/Jamfile.jam
index 48d306e..3d5fa77 100644
--- a/slicer/slicer/Jamfile.jam
+++ b/slicer/slicer/Jamfile.jam
@@ -13,7 +13,6 @@ lib slicer :
 	<library>boost_filesystem
 	<library>adhocutil
 	<include>..
-	<cflags>-fvisibility=hidden
 	: :
 	<include>..
 	<library>boost_system
diff --git a/slicer/slicer/parser.cpp b/slicer/slicer/parser.cpp
index 757dbbd..df9e501 100644
--- a/slicer/slicer/parser.cpp
+++ b/slicer/slicer/parser.cpp
@@ -36,13 +36,13 @@ namespace Slicer {
 		for (const auto & conversion : conversions) {
 			if (!AdHoc::containerContains(conversion.Options, "nodeclare")) {
 				if (!AdHoc::containerContains(conversion.Options, "nodeclareto")) {
-					fprintbf(cpp, "%s %s(const %s &);\n",
+					fprintbf(cpp, "DLL_PUBLIC %s %s(const %s &);\n",
 							conversion.ExchangeType,
 							conversion.ConvertToExchangeFunc,
 							Slice::typeToString(type));
 				}
 				if (!AdHoc::containerContains(conversion.Options, "nodeclarefrom")) {
-					fprintbf(cpp, "%s %s(const %s &);\n\n",
+					fprintbf(cpp, "DLL_PUBLIC %s %s(const %s &);\n\n",
 							Slice::typeToString(type),
 							conversion.ConvertToModelFunc,
 							conversion.ExchangeType);
diff --git a/slicer/test/conversions.cpp b/slicer/test/conversions.cpp
index 17ebfb0..5f7e699 100644
--- a/slicer/test/conversions.cpp
+++ b/slicer/test/conversions.cpp
@@ -4,6 +4,7 @@
 #define SHORT(x) boost::numeric_cast< ::Ice::Short , int64_t >(x)
 
 namespace Slicer {
+	DLL_PUBLIC
 	boost::posix_time::ptime
 	dateTimeToPTime(const ::TestModule::DateTime & dt)
 	{
@@ -11,6 +12,7 @@ namespace Slicer {
 				boost::posix_time::time_duration(dt.hour, dt.minute, dt.second));
 	}
 
+	DLL_PUBLIC
 	::TestModule::DateTime
 	ptimeToDateTime(const boost::posix_time::ptime & pt)
 	{
@@ -20,6 +22,7 @@ namespace Slicer {
 			});
 	}
 
+	DLL_PUBLIC
 	std::string
 	isoDateToString(const ::TestModule::IsoDate & in)
 	{
@@ -34,6 +37,7 @@ namespace Slicer {
 		return std::string(buf, len);
 	}
 
+	DLL_PUBLIC
 	::TestModule::IsoDate
 	stringToIsoDate(const std::string & in)
 	{
@@ -49,6 +53,7 @@ namespace Slicer {
 				SHORT(tm.tm_year + 1900), SHORT(tm.tm_mon + 1), SHORT(tm.tm_mday)});
 	}
 
+	DLL_PUBLIC
 	std::string
 	dateTimeToString(const ::TestModule::DateTime & in)
 	{
@@ -66,6 +71,7 @@ namespace Slicer {
 		return std::string(buf, len);
 	}
 
+	DLL_PUBLIC
 	::TestModule::DateTime
 	stringToDateTime(const std::string & in)
 	{
@@ -82,12 +88,14 @@ namespace Slicer {
 				SHORT(tm.tm_hour), SHORT(tm.tm_min), SHORT(tm.tm_sec)});
 	}
 
+	DLL_PUBLIC
 	::DB::Timespan
 	timedurationToTimespan(const boost::posix_time::time_duration & td)
 	{
 		return ::DB::Timespan({ SHORT(td.hours() / 24), SHORT(td.hours() % 24), SHORT(td.minutes()), SHORT(td.seconds()) });
 	}
 
+	DLL_PUBLIC
 	boost::posix_time::time_duration
 	timespanToTimeduration(const ::DB::Timespan & ts)
 	{
diff --git a/slicer/test/conversions.h b/slicer/test/conversions.h
index d462fb4..4fa2527 100644
--- a/slicer/test/conversions.h
+++ b/slicer/test/conversions.h
@@ -2,13 +2,16 @@
 #define SLICER_TEST_CONVERSIONS_H
 
 #include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <visibility.h>
 
 namespace TestModule {
 	class DateTime;
 }
 namespace Slicer {
+	DLL_PUBLIC
 	::TestModule::DateTime
 	stringToDateTime(const std::string & in);
+	DLL_PUBLIC
 	std::string
 	dateTimeToString(const ::TestModule::DateTime & in);
 }
diff --git a/slicer/test/fileStructure.h b/slicer/test/fileStructure.h
index e19f95c..4821fea 100644
--- a/slicer/test/fileStructure.h
+++ b/slicer/test/fileStructure.h
@@ -2,10 +2,11 @@
 #define SLICER_TEST_FILESTRUCTURE
 
 #include <boost/filesystem/path.hpp>
+#include <visibility.h>
 
 namespace fs = boost::filesystem;
 
-class FileStructure {
+class DLL_PUBLIC FileStructure {
 	public:
 		FileStructure();
 		~FileStructure();
diff --git a/slicer/test/helpers.h b/slicer/test/helpers.h
index 385ee64..aba4974 100644
--- a/slicer/test/helpers.h
+++ b/slicer/test/helpers.h
@@ -2,18 +2,23 @@
 #define SLICER_TEST_HELPERS_H
 
 #include <string>
+#include <visibility.h>
 #include <boost/filesystem/path.hpp>
 
 // These are just thin wrappers that throw exceptions
+DLL_PUBLIC
 void
 system(const std::string &);
 
+DLL_PUBLIC
 void *
 loadlib(const boost::filesystem::path &);
 
+DLL_PUBLIC
 void
 closelib(void *);
 
+DLL_PUBLIC
 void
 diff(const boost::filesystem::path & left, const boost::filesystem::path & right);
 
diff --git a/slicer/tool/Jamfile.jam b/slicer/tool/Jamfile.jam
index 1664d9d..16942a0 100644
--- a/slicer/tool/Jamfile.jam
+++ b/slicer/tool/Jamfile.jam
@@ -5,5 +5,4 @@ exe slicer :
 	:
 	<library>../slicer//slicer
 	<library>po
-	<cflags>-fvisibility=hidden
 	;
diff --git a/slicer/xml/Jamfile.jam b/slicer/xml/Jamfile.jam
index 655358b..76b97af 100644
--- a/slicer/xml/Jamfile.jam
+++ b/slicer/xml/Jamfile.jam
@@ -15,7 +15,6 @@ lib slicer-xml :
 	<library>../..//libxmlpp
 	<library>adhocutil
 	<library>../slicer//slicer
-	<cflags>-fvisibility=hidden
 	: :
 	<library>../..//libxmlpp
 	;
-- 
cgit v1.2.3