summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2015-05-05 19:23:45 -0400
committerBernard Normier <bernard@zeroc.com>2015-05-05 19:23:45 -0400
commita5bd24845a2720d57a66d81effc59423d723c87c (patch)
tree76faa296700b0993deb3aa97323abc904188a681
parentminor fixes for purify (diff)
downloadice-a5bd24845a2720d57a66d81effc59423d723c87c.tar.bz2
ice-a5bd24845a2720d57a66d81effc59423d723c87c.tar.xz
ice-a5bd24845a2720d57a66d81effc59423d723c87c.zip
ICE-6481 pragma comment when building static libraries
On windows with VS, pragma comment is now defined when building only when ICE_BUILDING_<component-name> is not defined. ICE_BUILDING_<component-name> is defined automatically when <component-name>_API_EXPORTS is defined. When building static Ice libraries on Windows, please define ICE_BUILDING_<component-name-being-built>. ICE_DECLSPEC_EXPORT and ICE_DECLSPEC_IMPORT are now defined all the time on Windows, and we define the various _API macros to /**/ when ICE_STATIC_LIBS is defined. Replaced various direct use of ICE_DECLSPEC_EXPORT/ICE_DECLSPEC_IMPORT by the correct _API macro.
-rw-r--r--cpp/include/Freeze/Initialize.h10
-rw-r--r--cpp/include/Glacier2/Config.h13
-rw-r--r--cpp/include/Glacier2/NullPermissionsVerifier.h2
-rw-r--r--cpp/include/Ice/Config.h19
-rw-r--r--cpp/include/IceBox/Config.h13
-rw-r--r--cpp/include/IceGrid/Config.h13
-rw-r--r--cpp/include/IcePatch2/Config.h13
-rw-r--r--cpp/include/IceSSL/Plugin.h13
-rw-r--r--cpp/include/IceStorm/Config.h13
-rw-r--r--cpp/include/IceUtil/Config.h18
-rw-r--r--cpp/include/Slice/Parser.h15
-rw-r--r--cpp/include/Slice/Preprocessor.h2
-rw-r--r--cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp10
-rw-r--r--cpp/src/Glacier2CryptPermissionsVerifier/Makefile2
-rw-r--r--cpp/src/Glacier2CryptPermissionsVerifier/Makefile.mak2
-rw-r--r--cpp/src/Ice/FactoryTableInit.cpp2
-rw-r--r--cpp/src/Ice/Incoming.cpp2
-rw-r--r--cpp/src/Ice/Instance.cpp4
-rw-r--r--cpp/src/Ice/LoggerUtil.cpp2
-rw-r--r--cpp/src/Ice/ServantManager.cpp2
-rw-r--r--cpp/src/Ice/ThreadPool.cpp2
-rw-r--r--cpp/src/Ice/TraceLevels.cpp2
-rw-r--r--cpp/src/IceDiscovery/Makefile2
-rw-r--r--cpp/src/IceDiscovery/Makefile.mak2
-rw-r--r--cpp/src/IceDiscovery/PluginI.cpp10
-rw-r--r--cpp/src/IceLocatorDiscovery/Makefile2
-rw-r--r--cpp/src/IceLocatorDiscovery/Makefile.mak2
-rw-r--r--cpp/src/IceLocatorDiscovery/PluginI.cpp10
-rw-r--r--cpp/src/IceSSL/PluginI.cpp2
-rw-r--r--cpp/src/IceStorm/Service.cpp2
-rw-r--r--cpp/src/IceStorm/Service.h15
-rw-r--r--cpp/src/IceUtil/Exception.cpp4
-rw-r--r--cpp/src/IceXML/Parser.h13
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp2
-rw-r--r--cpp/src/slice2cpp/Gen.cpp14
-rw-r--r--cpp/src/slice2objc/Gen.cpp2
-rw-r--r--cpp/test/Ice/background/PluginI.h2
37 files changed, 169 insertions, 89 deletions
diff --git a/cpp/include/Freeze/Initialize.h b/cpp/include/Freeze/Initialize.h
index 77b99acc924..1f80407e77f 100644
--- a/cpp/include/Freeze/Initialize.h
+++ b/cpp/include/Freeze/Initialize.h
@@ -19,11 +19,13 @@
//
// Automatically link Freeze[D].lib with Visual C++
//
+#if !defined(ICE_BUILDING_FREEZE) && defined(FREEZE_API_EXPORTS)
+# define ICE_BUILDING_FREEZE
+#endif
+
#ifdef _MSC_VER
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "Freeze.lib")
-# elif !defined(FREEZE_API_EXPORTS)
-# if defined(_DEBUG)
+# if !defined(ICE_BUILDING_FREEZE)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "FreezeD.lib")
# else
# pragma comment(lib, "Freeze.lib")
diff --git a/cpp/include/Glacier2/Config.h b/cpp/include/Glacier2/Config.h
index 280a49e2409..9f4efe2b040 100644
--- a/cpp/include/Glacier2/Config.h
+++ b/cpp/include/Glacier2/Config.h
@@ -10,14 +10,17 @@
#ifndef GLACIER2_CONFIG_H
#define GLACIER2_CONFIG_H
-#ifdef _MSC_VER
//
// Automatically link with Glacier2[D].lib
//
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "Glacier2.lib")
-# elif !defined(GLACIER2_API_EXPORTS)
-# if defined(_DEBUG)
+
+#if !defined(ICE_BUILDING_GLACIER2) && defined(GLACIER2_API_EXPORTS)
+# define ICE_BUILDING_GLACIER2
+#endif
+
+#ifdef _MSC_VER
+# if !defined(ICE_BUILDING_GLACIER2)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "Glacier2D.lib")
# else
# pragma comment(lib, "Glacier2.lib")
diff --git a/cpp/include/Glacier2/NullPermissionsVerifier.h b/cpp/include/Glacier2/NullPermissionsVerifier.h
index b18230fb212..fbb868c42f3 100644
--- a/cpp/include/Glacier2/NullPermissionsVerifier.h
+++ b/cpp/include/Glacier2/NullPermissionsVerifier.h
@@ -18,6 +18,8 @@
#ifndef GLACIER2_API
# ifdef GLACIER2_API_EXPORTS
# define GLACIER2_API ICE_DECLSPEC_EXPORT
+# elif defined(ICE_STATIC_LIBS)
+# define GLACIER2_API /**/
# else
# define GLACIER2_API ICE_DECLSPEC_IMPORT
# endif
diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h
index 6acc0784de3..8dbfb467c06 100644
--- a/cpp/include/Ice/Config.h
+++ b/cpp/include/Ice/Config.h
@@ -35,11 +35,14 @@
//
// Automatically link Ice[D].lib with Visual C++
//
-#if defined(_MSC_VER) && !defined(ICE_NO_PRAGMA_COMMENT)
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "Ice.lib")
-# elif !defined(ICE_API_EXPORTS)
-# if defined(_DEBUG)
+
+#if !defined(ICE_BUILDING_ICE) && defined(ICE_API_EXPORTS)
+# define ICE_BUILDING_ICE
+#endif
+
+#if defined(_MSC_VER)
+# if !defined(ICE_BUILDING_ICE)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "IceD.lib")
# else
# pragma comment(lib, "Ice.lib")
@@ -65,9 +68,11 @@ namespace IceInternal
#ifndef ICE_API
# ifdef ICE_API_EXPORTS
# define ICE_API ICE_DECLSPEC_EXPORT
-# else
+# elif defined(ICE_STATIC_LIBS)
+# define ICE_API /**/
+# else
# define ICE_API ICE_DECLSPEC_IMPORT
-# endif
+# endif
#endif
namespace Ice
diff --git a/cpp/include/IceBox/Config.h b/cpp/include/IceBox/Config.h
index b95e5bf1700..fa925dd6e86 100644
--- a/cpp/include/IceBox/Config.h
+++ b/cpp/include/IceBox/Config.h
@@ -10,14 +10,17 @@
#ifndef ICE_BOX_CONFIG_H
#define ICE_BOX_CONFIG_H
-#ifdef _MSC_VER
//
// Automatically link with IceBox[D].lib
//
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "IceBox.lib")
-# elif !defined(ICE_BOX_API_EXPORTS)
-# if defined(_DEBUG)
+
+#if !defined(ICE_BUILDING_ICE_BOX) && defined(ICE_BOX_API_EXPORTS)
+# define ICE_BUILDING_ICE_BOX
+#endif
+
+#ifdef _MSC_VER
+# if !defined(ICE_BUILDING_ICE_BOX)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "IceBoxD.lib")
# else
# pragma comment(lib, "IceBox.lib")
diff --git a/cpp/include/IceGrid/Config.h b/cpp/include/IceGrid/Config.h
index eafc2a1827e..c86a38ef3cf 100644
--- a/cpp/include/IceGrid/Config.h
+++ b/cpp/include/IceGrid/Config.h
@@ -10,14 +10,17 @@
#ifndef ICE_GRID_CONFIG_H
#define ICE_GRID_CONFIG_H
-#ifdef _MSC_VER
//
// Automatically link with IceGrid[D].lib
//
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "IceGrid.lib")
-# elif !defined(ICE_GRID_API_EXPORTS)
-# if defined(_DEBUG)
+
+#if !defined(ICE_BUILDING_ICE_GRID) && defined(ICE_GRID_API_EXPORTS)
+# define ICE_BUILDING_ICE_GRID
+#endif
+
+#ifdef _MSC_VER
+# if !defined(ICE_BUILDING_ICE_GRID)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "IceGridD.lib")
# else
# pragma comment(lib, "IceGrid.lib")
diff --git a/cpp/include/IcePatch2/Config.h b/cpp/include/IcePatch2/Config.h
index 0a5608eb122..12457f45e7a 100644
--- a/cpp/include/IcePatch2/Config.h
+++ b/cpp/include/IcePatch2/Config.h
@@ -10,14 +10,17 @@
#ifndef ICE_PATCH2_CONFIG_H
#define ICE_PATCH2_CONFIG_H
-#ifdef _MSC_VER
//
// Automatically link with IcePatch2[D].lib
//
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "IcePatch2.lib")
-# elif !defined(ICE_PATCH2_API_EXPORTS)
-# if defined(_DEBUG)
+
+#if !defined(ICE_BUILDING_ICE_PATCH2) && defined(ICE_PATCH2_API_EXPORTS)
+# define ICE_BUILDING_ICE_PATCH2
+#endif
+
+#ifdef _MSC_VER
+# if !defined(ICE_BUILDING_ICE_PATCH2)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "IcePatch2D.lib")
# else
# pragma comment(lib, "IcePatch2.lib")
diff --git a/cpp/include/IceSSL/Plugin.h b/cpp/include/IceSSL/Plugin.h
index 367fd73c5dd..772ce4225a1 100644
--- a/cpp/include/IceSSL/Plugin.h
+++ b/cpp/include/IceSSL/Plugin.h
@@ -21,9 +21,14 @@
//
// Automatically link IceSSL[D].lib with Visual C++
//
-#if defined(_MSC_VER) && !defined(ICE_NO_PRAGMA_COMMENT)
-# if !defined(ICE_STATIC_LIBS) && !defined(ICE_SSL_API_EXPORTS)
-# if defined(_DEBUG)
+
+#if !defined(ICE_BUILDING_ICE_SSL) && defined(ICE_SSL_API_EXPORTS)
+# define ICE_BUILDING_ICE_SSL
+#endif
+
+#if defined(_MSC_VER)
+# if !defined(ICE_BUILDING_ICE_SSL)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "IceSSLD.lib")
# else
# pragma comment(lib, "IceSSL.lib")
@@ -47,6 +52,8 @@
#ifndef ICE_SSL_API
# ifdef ICE_SSL_API_EXPORTS
# define ICE_SSL_API ICE_DECLSPEC_EXPORT
+# elif defined(ICE_STATIC_LIBS)
+# define ICE_SSL_API /**/
# else
# define ICE_SSL_API ICE_DECLSPEC_IMPORT
# endif
diff --git a/cpp/include/IceStorm/Config.h b/cpp/include/IceStorm/Config.h
index b072ce43827..0a7f3cb9794 100644
--- a/cpp/include/IceStorm/Config.h
+++ b/cpp/include/IceStorm/Config.h
@@ -10,14 +10,17 @@
#ifndef ICE_STORM_CONFIG_H
#define ICE_STORM_CONFIG_H
-#ifdef _MSC_VER
//
// Automatically link with IceStorm[D].lib
//
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "IceStorm.lib")
-# elif !defined(ICE_STORM_LIB_API_EXPORTS)
-# if defined(_DEBUG)
+
+#if !defined(ICE_BUILDING_ICE_STORM_LIB) && defined(ICE_STORM_LIB_API_EXPORTS)
+# define ICE_BUILDING_ICE_STORM_LIB
+#endif
+
+#ifdef _MSC_VER
+# if !defined(ICE_BUILDING_ICE_STORM_LIB)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "IceStormD.lib")
# else
# pragma comment(lib, "IceStorm.lib")
diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h
index 471fe9881c5..c834d1c0c3c 100644
--- a/cpp/include/IceUtil/Config.h
+++ b/cpp/include/IceUtil/Config.h
@@ -97,7 +97,7 @@
// Compiler extensions to export and import symbols: see the documentation
// for Visual Studio, Solaris Studio and GCC.
//
-#if defined(_WIN32) && !defined(ICE_STATIC_LIBS)
+#if defined(_WIN32)
# define ICE_DECLSPEC_EXPORT __declspec(dllexport)
# define ICE_DECLSPEC_IMPORT __declspec(dllimport)
//
@@ -118,8 +118,10 @@
//
// Let's use these extensions with IceUtil:
//
-#ifdef ICE_UTIL_API_EXPORTS
+#if defined(ICE_UTIL_API_EXPORTS)
# define ICE_UTIL_API ICE_DECLSPEC_EXPORT
+#elif defined(ICE_STATIC_LIBS)
+# define ICE_UTIL_API /**/
#else
# define ICE_UTIL_API ICE_DECLSPEC_IMPORT
#endif
@@ -173,17 +175,19 @@
# include <TargetConditionals.h>
#endif
-#if defined(_MSC_VER) && !defined(ICE_NO_PRAGMA_COMMENT)
+#if !defined(ICE_BUILDING_ICE_UTIL) && defined(ICE_UTIL_API_EXPORTS)
+# define ICE_BUILDING_ICE_UTIL
+#endif
+
+#if defined(_MSC_VER)
# if !defined(ICE_STATIC_LIBS) && (!defined(_DLL) || !defined(_MT))
# error "Only multi-threaded DLL libraries can be used with Ice!"
# endif
//
// Automatically link with IceUtil[D].lib
//
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "IceUtil.lib")
-# elif !defined(ICE_UTIL_API_EXPORTS)
-# if defined(_DEBUG)
+# if !defined(ICE_BUILDING_ICE_UTIL)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "IceUtilD.lib")
# else
# pragma comment(lib, "IceUtil.lib")
diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h
index 257e1df5987..2ca3e84bfc4 100644
--- a/cpp/include/Slice/Parser.h
+++ b/cpp/include/Slice/Parser.h
@@ -23,11 +23,14 @@
//
// Automatically link Slice[D].lib with Visual C++
//
-#if defined(_MSC_VER) && !defined(ICE_NO_PRAGMA_COMMENT)
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "Slice.lib")
-# elif !defined(SLICE_API_EXPORTS)
-# if defined(_DEBUG)
+
+#if !defined(ICE_BUILDING_SLICE) && defined(SLICE_API_EXPORTS)
+# define ICE_BUILDING_SLICE
+#endif
+
+#if defined(_MSC_VER)
+# if !defined(ICE_BUILDING_SLICE)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "SliceD.lib")
# else
# pragma comment(lib, "Slice.lib")
@@ -38,6 +41,8 @@
#ifndef SLICE_API
# ifdef SLICE_API_EXPORTS
# define SLICE_API ICE_DECLSPEC_EXPORT
+# elif defined(ICE_STATIC_LIBS)
+# define SLICE_API /**/
# else
# define SLICE_API ICE_DECLSPEC_IMPORT
# endif
diff --git a/cpp/include/Slice/Preprocessor.h b/cpp/include/Slice/Preprocessor.h
index 08125e0fb2f..1e109c09e73 100644
--- a/cpp/include/Slice/Preprocessor.h
+++ b/cpp/include/Slice/Preprocessor.h
@@ -17,6 +17,8 @@
#ifndef SLICE_API
# ifdef SLICE_API_EXPORTS
# define SLICE_API ICE_DECLSPEC_EXPORT
+# elif defined(ICE_STATIC_LIBS)
+# define SLICE_API /**/
# else
# define SLICE_API ICE_DECLSPEC_IMPORT
# endif
diff --git a/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp b/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp
index 0e8adefac55..f5ee4e56e69 100644
--- a/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp
+++ b/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp
@@ -440,13 +440,21 @@ CryptPermissionsVerifierPlugin::destroy()
}
+#ifndef CRYPT_PERMISSIONS_VERIFIER_API
+# ifdef CRYPT_PERMISSIONS_VERIFIER_API_EXPORTS
+# define CRYPT_PERMISSIONS_VERIFIER_API ICE_DECLSPEC_EXPORT
+# else
+# define CRYPT_PERMISSIONS_VERIFIER_API /**/
+# endif
+#endif
+
//
// Plug-in factory function.
//
extern "C"
{
-ICE_DECLSPEC_EXPORT Ice::Plugin*
+CRYPT_PERMISSIONS_VERIFIER_API Ice::Plugin*
createCryptPermissionsVerifier(const CommunicatorPtr& communicator, const string& name, const StringSeq& args)
{
if(args.size() > 0)
diff --git a/cpp/src/Glacier2CryptPermissionsVerifier/Makefile b/cpp/src/Glacier2CryptPermissionsVerifier/Makefile
index f3c49c50313..5dad9fb18c0 100644
--- a/cpp/src/Glacier2CryptPermissionsVerifier/Makefile
+++ b/cpp/src/Glacier2CryptPermissionsVerifier/Makefile
@@ -22,7 +22,7 @@ SRCS = $(OBJS:.o=.cpp)
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I.. $(CPPFLAGS)
+CPPFLAGS := -I.. $(CPPFLAGS) -DCRYPT_PERMISSIONS_VERIFIER_API_EXPORTS
LINKWITH := $(BZIP2_RPATH_LINK) -lIce -lIceUtil -lGlacier2 $(CRYPT_OS_LIBS) $(CXXLIBS)
diff --git a/cpp/src/Glacier2CryptPermissionsVerifier/Makefile.mak b/cpp/src/Glacier2CryptPermissionsVerifier/Makefile.mak
index 3828a45771e..6bb7e10f113 100644
--- a/cpp/src/Glacier2CryptPermissionsVerifier/Makefile.mak
+++ b/cpp/src/Glacier2CryptPermissionsVerifier/Makefile.mak
@@ -18,7 +18,7 @@ OBJS = .\CryptPermissionsVerifierI.obj
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN -DCRYPT_PERMISSIONS_VERIFIER_API_EXPORTS
LINKWITH = $(LIBS) crypt32.lib bcrypt.lib
diff --git a/cpp/src/Ice/FactoryTableInit.cpp b/cpp/src/Ice/FactoryTableInit.cpp
index 0c411d866fb..9b1675e17c4 100644
--- a/cpp/src/Ice/FactoryTableInit.cpp
+++ b/cpp/src/Ice/FactoryTableInit.cpp
@@ -19,7 +19,7 @@ namespace IceInternal
// Single global instance of the factory table for non-local
// exceptions and non-abstract classes.
//
-ICE_DECLSPEC_EXPORT FactoryTable* factoryTable;
+ICE_API FactoryTable* factoryTable;
}
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index 0db2702359a..8b7e8a33ea4 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -33,7 +33,7 @@ using namespace IceInternal;
namespace IceUtilInternal
{
-extern bool ICE_DECLSPEC_IMPORT printStackTraces;
+extern bool ICE_UTIL_API printStackTraces;
}
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 59d2287ac1f..f1c18496a1c 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -74,8 +74,8 @@ using namespace IceInternal;
namespace IceUtilInternal
{
-extern bool ICE_DECLSPEC_IMPORT nullHandleAbort;
-extern bool ICE_DECLSPEC_IMPORT printStackTraces;
+extern bool ICE_UTIL_API nullHandleAbort;
+extern bool ICE_UTIL_API printStackTraces;
};
diff --git a/cpp/src/Ice/LoggerUtil.cpp b/cpp/src/Ice/LoggerUtil.cpp
index a28016cc47b..71316293ba6 100644
--- a/cpp/src/Ice/LoggerUtil.cpp
+++ b/cpp/src/Ice/LoggerUtil.cpp
@@ -19,7 +19,7 @@ using namespace std;
namespace IceUtilInternal
{
-extern bool ICE_DECLSPEC_IMPORT printStackTraces;
+extern bool ICE_UTIL_API printStackTraces;
}
diff --git a/cpp/src/Ice/ServantManager.cpp b/cpp/src/Ice/ServantManager.cpp
index e07e78dbbc9..99b1a862176 100644
--- a/cpp/src/Ice/ServantManager.cpp
+++ b/cpp/src/Ice/ServantManager.cpp
@@ -18,7 +18,7 @@ using namespace std;
using namespace Ice;
using namespace IceInternal;
-ICE_DECLSPEC_EXPORT IceUtil::Shared* IceInternal::upCast(ServantManager* p) { return p; }
+ICE_API IceUtil::Shared* IceInternal::upCast(ServantManager* p) { return p; }
void
IceInternal::ServantManager::addServant(const ObjectPtr& object, const Identity& ident, const string& facet)
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 6cfe2d7b09c..b2e7883c325 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -28,7 +28,7 @@ using namespace Ice;
using namespace Ice::Instrumentation;
using namespace IceInternal;
-ICE_DECLSPEC_EXPORT IceUtil::Shared* IceInternal::upCast(ThreadPool* p) { return p; }
+ICE_API IceUtil::Shared* IceInternal::upCast(ThreadPool* p) { return p; }
namespace
{
diff --git a/cpp/src/Ice/TraceLevels.cpp b/cpp/src/Ice/TraceLevels.cpp
index 7dbc991a33a..faef767c32c 100644
--- a/cpp/src/Ice/TraceLevels.cpp
+++ b/cpp/src/Ice/TraceLevels.cpp
@@ -14,7 +14,7 @@ using namespace std;
using namespace Ice;
using namespace IceInternal;
-ICE_DECLSPEC_EXPORT IceUtil::Shared* IceInternal::upCast(TraceLevels* p) { return p; }
+ICE_API IceUtil::Shared* IceInternal::upCast(TraceLevels* p) { return p; }
IceInternal::TraceLevels::TraceLevels(const PropertiesPtr& properties) :
network(0),
diff --git a/cpp/src/IceDiscovery/Makefile b/cpp/src/IceDiscovery/Makefile
index 356ea66e20e..5b462737114 100644
--- a/cpp/src/IceDiscovery/Makefile
+++ b/cpp/src/IceDiscovery/Makefile
@@ -27,7 +27,7 @@ SDIR = $(slicedir)/IceDiscovery
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I.. $(CPPFLAGS)
+CPPFLAGS := -I.. $(CPPFLAGS) -DICE_DISCOVERY_API_EXPORTS
SLICE2CPPFLAGS := --ice --include-dir IceDiscovery $(SLICE2CPPFLAGS)
LINKWITH := -lIce -lIceUtil $(CXXLIBS)
diff --git a/cpp/src/IceDiscovery/Makefile.mak b/cpp/src/IceDiscovery/Makefile.mak
index 3c0a9a6a28b..168a95fda7e 100644
--- a/cpp/src/IceDiscovery/Makefile.mak
+++ b/cpp/src/IceDiscovery/Makefile.mak
@@ -24,7 +24,7 @@ OBJS = .\LocatorI.obj \
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN -DICE_DISCOVERY_API_EXPORTS
SLICE2CPPFLAGS = --ice --include-dir IceDiscovery $(SLICE2CPPFLAGS)
LINKWITH = $(LIBS)
diff --git a/cpp/src/IceDiscovery/PluginI.cpp b/cpp/src/IceDiscovery/PluginI.cpp
index fd4d6dbdf03..387fffd21fa 100644
--- a/cpp/src/IceDiscovery/PluginI.cpp
+++ b/cpp/src/IceDiscovery/PluginI.cpp
@@ -17,13 +17,21 @@
using namespace std;
using namespace IceDiscovery;
+#ifndef ICE_DISCOVERY_API
+# ifdef ICE_DISCOVERY_API_EXPORTS
+# define ICE_DISCOVERY_API ICE_DECLSPEC_EXPORT
+# else
+# define ICE_DISCOVERY_API /**/
+# endif
+#endif
+
//
// Plugin factory function.
//
extern "C"
{
-ICE_DECLSPEC_EXPORT Ice::Plugin*
+ICE_DISCOVERY_API Ice::Plugin*
createIceDiscovery(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&)
{
return new PluginI(communicator);
diff --git a/cpp/src/IceLocatorDiscovery/Makefile b/cpp/src/IceLocatorDiscovery/Makefile
index 0e7cc99ce87..dedc6856ba0 100644
--- a/cpp/src/IceLocatorDiscovery/Makefile
+++ b/cpp/src/IceLocatorDiscovery/Makefile
@@ -22,7 +22,7 @@ OBJS = PluginI.o \
include $(top_srcdir)/config/Make.rules
-CPPFLAGS := -I.. $(CPPFLAGS)
+CPPFLAGS := -I.. $(CPPFLAGS) -DICE_LOCATOR_DISCOVERY_API_EXPORTS
SLICE2CPPFLAGS := --ice --include-dir IceLocatorDiscovery $(SLICE2CPPFLAGS)
LINKWITH := -lIce -lIceUtil $(CXXLIBS)
diff --git a/cpp/src/IceLocatorDiscovery/Makefile.mak b/cpp/src/IceLocatorDiscovery/Makefile.mak
index 3e9caa3e5d2..226cdf08ace 100644
--- a/cpp/src/IceLocatorDiscovery/Makefile.mak
+++ b/cpp/src/IceLocatorDiscovery/Makefile.mak
@@ -22,7 +22,7 @@ OBJS = .\PluginI.obj \
!include $(top_srcdir)/config/Make.rules.mak
-CPPFLAGS = -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+CPPFLAGS = -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN -DICE_LOCATOR_DISCOVERY_API_EXPORTS
SLICE2CPPFLAGS = --ice --include-dir IceLocatorDiscovery $(SLICE2CPPFLAGS)
LINKWITH = $(LIBS)
diff --git a/cpp/src/IceLocatorDiscovery/PluginI.cpp b/cpp/src/IceLocatorDiscovery/PluginI.cpp
index 7e391460de5..fb79d4b8529 100644
--- a/cpp/src/IceLocatorDiscovery/PluginI.cpp
+++ b/cpp/src/IceLocatorDiscovery/PluginI.cpp
@@ -16,13 +16,21 @@
using namespace std;
using namespace IceLocatorDiscovery;
+#ifndef ICE_LOCATOR_DISCOVERY_API
+# ifdef ICE_LOCATOR_DISCOVERY_API_EXPORTS
+# define ICE_LOCATOR_DISCOVERY_API ICE_DECLSPEC_EXPORT
+# else
+# define ICE_LOCATOR_DISCOVERY_API /**/
+# endif
+#endif
+
//
// Plugin factory function.
//
extern "C"
{
-ICE_DECLSPEC_EXPORT Ice::Plugin*
+ICE_LOCATOR_DISCOVERY_API Ice::Plugin*
createIceLocatorDiscovery(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&)
{
return new PluginI(communicator);
diff --git a/cpp/src/IceSSL/PluginI.cpp b/cpp/src/IceSSL/PluginI.cpp
index 6c9183cca5c..44b5bcecad3 100644
--- a/cpp/src/IceSSL/PluginI.cpp
+++ b/cpp/src/IceSSL/PluginI.cpp
@@ -26,7 +26,7 @@ using namespace IceSSL;
extern "C"
{
-ICE_DECLSPEC_EXPORT Ice::Plugin*
+ICE_SSL_API Ice::Plugin*
createIceSSL(const CommunicatorPtr& communicator, const string& /*name*/, const StringSeq& /*args*/)
{
return new PluginI(communicator);
diff --git a/cpp/src/IceStorm/Service.cpp b/cpp/src/IceStorm/Service.cpp
index ea23ea77375..b6e98a87c05 100644
--- a/cpp/src/IceStorm/Service.cpp
+++ b/cpp/src/IceStorm/Service.cpp
@@ -95,7 +95,7 @@ private:
extern "C"
{
-ICE_DECLSPEC_EXPORT ::IceBox::Service*
+ICE_STORM_SERVICE_API ::IceBox::Service*
createIceStorm(CommunicatorPtr communicator)
{
return new ServiceI;
diff --git a/cpp/src/IceStorm/Service.h b/cpp/src/IceStorm/Service.h
index 486844ea229..212b38a9104 100644
--- a/cpp/src/IceStorm/Service.h
+++ b/cpp/src/IceStorm/Service.h
@@ -13,14 +13,17 @@
#include <IceBox/IceBox.h>
#include <IceStorm/IceStorm.h>
-#ifdef _MSC_VER
//
// Automatically link with IceStormService[D].lib
//
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "IceStormService.lib")
-# elif !defined(ICE_STORM_SERVICE_API_EXPORTS)
-# if defined(_DEBUG)
+
+#if !defined(ICE_BUILDING_ICE_STORM_SERVICE) && defined(ICE_STORM_SERVICE_API_EXPORTS)
+# define ICE_BUILDING_ICE_STORM_SERVICE
+#endif
+
+#ifdef _MSC_VER
+# if !defined(ICE_BUILDING_ICE_STORM_SERVICE)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "IceStormServiceD.lib")
# else
# pragma comment(lib, "IceStormService.lib")
@@ -31,6 +34,8 @@
#ifndef ICE_STORM_SERVICE_API
# ifdef ICE_STORM_SERVICE_API_EXPORTS
# define ICE_STORM_SERVICE_API ICE_DECLSPEC_EXPORT
+# elif defined(ICE_STATIC_LIBS)
+# define ICE_STORM_SERVICE_API /**/
# else
# define ICE_STORM_SERVICE_API ICE_DECLSPEC_IMPORT
# endif
diff --git a/cpp/src/IceUtil/Exception.cpp b/cpp/src/IceUtil/Exception.cpp
index d21946f8195..947815467d6 100644
--- a/cpp/src/IceUtil/Exception.cpp
+++ b/cpp/src/IceUtil/Exception.cpp
@@ -54,8 +54,8 @@ using namespace std;
namespace IceUtilInternal
{
-bool ICE_DECLSPEC_EXPORT printStackTraces = false;
-bool ICE_DECLSPEC_EXPORT nullHandleAbort = false;
+bool ICE_UTIL_API printStackTraces = false;
+bool ICE_UTIL_API nullHandleAbort = false;
}
diff --git a/cpp/src/IceXML/Parser.h b/cpp/src/IceXML/Parser.h
index c8f1f4a8bbb..f5de9291968 100644
--- a/cpp/src/IceXML/Parser.h
+++ b/cpp/src/IceXML/Parser.h
@@ -20,6 +20,8 @@
#ifndef ICE_XML_API
# ifdef ICE_XML_API_EXPORTS
# define ICE_XML_API ICE_DECLSPEC_EXPORT
+# elif defined(ICE_STATIC_LIBS)
+# define ICE_XML_API /**/
# else
# define ICE_XML_API ICE_DECLSPEC_IMPORT
# endif
@@ -28,11 +30,14 @@
//
// Automatically link IceXML[D].lib with Visual C++
//
+
+#if !defined(ICE_BUILDING_ICE_XML) && defined(ICE_XML_API_EXPORTS)
+# define ICE_BUILDING_ICE_XML
+#endif
+
#ifdef _MSC_VER
-# if defined(ICE_STATIC_LIBS)
-# pragma comment(lib, "IceXML.lib")
-# elif !defined(ICE_XML_API_EXPORTS)
-# if defined(_DEBUG)
+# if !defined(ICE_BUILDING_ICE_XML)
+# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
# pragma comment(lib, "IceXMLD.lib")
# else
# pragma comment(lib, "IceXML.lib")
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index 95b34a2ec66..e50b4908eab 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -441,6 +441,8 @@ Slice::printDllExportStuff(Output& out, const string& dllExport)
out << "\n#ifndef " << dllExport;
out << "\n# ifdef " << dllExport << "_EXPORTS";
out << "\n# define " << dllExport << " ICE_DECLSPEC_EXPORT";
+ out << "\n# elif defined(ICE_STATIC_LIBS)";
+ out << "\n# define " << dllExport << " /**/";
out << "\n# else";
out << "\n# define " << dllExport << " ICE_DECLSPEC_IMPORT";
out << "\n# endif";
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index eb030600d1e..9e8d68722cb 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1474,14 +1474,13 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
// To export the virtual table
//
C << nl << "#ifdef __SUNPRO_CC";
- C << nl << "class "
- << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ")
- << "IceProxy" << scoped << ";";
+ C << nl << "class " << _dllExport
+ << "IceProxy" << scoped << ";";
C << nl << "#endif";
}
C << nl
- << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ")
+ << _dllExport
<< "::IceProxy::Ice::Object* ::IceProxy" << scope << "upCast(::IceProxy" << scoped
<< "* p) { return p; }";
@@ -2789,7 +2788,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isLocal())
{
C << sp << nl
- << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ")
+ << _dllExport
<< "::Ice::Object* " << scope.substr(2) << "upCast(" << scoped << "* p) { return p; }";
//
@@ -2917,7 +2916,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
else
{
C << sp << nl
- << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ")
+ << _dllExport
<< "::Ice::LocalObject* " << scope.substr(2) << "upCast(" << scoped << "* p) { return p; }";
}
@@ -3340,8 +3339,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
}
else
{
- C << sp << nl << "void "
- << (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ");
+ C << sp << nl << "void " << _dllExport;
C << nl << scope.substr(2) << "__patch(" << p->name() << "Ptr& handle, const ::Ice::ObjectPtr& v)";
C << sb;
C << nl << "handle = " << scope << p->name() << "Ptr::dynamicCast(v);";
diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp
index a8c6b825ae5..36cd2c990c2 100644
--- a/cpp/src/slice2objc/Gen.cpp
+++ b/cpp/src/slice2objc/Gen.cpp
@@ -759,6 +759,8 @@ Slice::Gen::generate(const UnitPtr& p)
_H << nl << "#ifndef " << _dllExport;
_H << nl << "# ifdef " << _dllExport << "_EXPORTS";
_H << nl << "# define " << _dllExport << " ICE_DECLSPEC_EXPORT";
+ _H << nl << "# elif defined(ICE_STATIC_LIBS)";
+ _H << nl << "# define " << _dllExport << " /**/";
_H << nl << "# else";
_H << nl << "# define " << _dllExport << " ICE_DECLSPEC_IMPORT";
_H << nl << "# endif";
diff --git a/cpp/test/Ice/background/PluginI.h b/cpp/test/Ice/background/PluginI.h
index f37bc155c2c..2aa01088df6 100644
--- a/cpp/test/Ice/background/PluginI.h
+++ b/cpp/test/Ice/background/PluginI.h
@@ -16,6 +16,8 @@
#ifndef TEST_API
# ifdef TEST_API_EXPORTS
# define TEST_API ICE_DECLSPEC_EXPORT
+# elif defined(ICE_STATIC_LIBS)
+# define TEST_API /**/
# else
# define TEST_API ICE_DECLSPEC_IMPORT
# endif