summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2012-07-26 17:13:54 +0200
committerJose <jose@zeroc.com>2012-07-26 17:13:54 +0200
commitad088c09c2a5022eb12dbea4523242e05c5d7bdd (patch)
treecc69971ee6374439033067c698c5589f978864a7 /cpp/src
parentvsadding - fix for update reverse dependencies (diff)
downloadice-ad088c09c2a5022eb12dbea4523242e05c5d7bdd.tar.bz2
ice-ad088c09c2a5022eb12dbea4523242e05c5d7bdd.tar.xz
ice-ad088c09c2a5022eb12dbea4523242e05c5d7bdd.zip
MinGW & Ruby-1.9 updates
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Application.cpp4
-rw-r--r--cpp/src/Ice/Makefile36
-rw-r--r--cpp/src/Ice/Network.cpp2
-rw-r--r--cpp/src/Ice/Network.h17
-rw-r--r--cpp/src/Ice/Service.cpp9
-rw-r--r--cpp/src/Ice/StringConverter.cpp5
-rw-r--r--cpp/src/Ice/TcpAcceptor.cpp2
-rw-r--r--cpp/src/Ice/TcpTransceiver.cpp4
-rw-r--r--cpp/src/Ice/ThreadPool.h2
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp4
-rw-r--r--cpp/src/IceSSL/AcceptorI.cpp2
-rw-r--r--cpp/src/IceSSL/Makefile28
-rw-r--r--cpp/src/IceSSL/TransceiverI.cpp4
-rw-r--r--cpp/src/IceUtil/Exception.cpp8
-rw-r--r--cpp/src/IceUtil/FileUtil.cpp31
-rw-r--r--cpp/src/IceUtil/InputUtil.cpp8
-rw-r--r--cpp/src/IceUtil/Makefile29
-rw-r--r--cpp/src/IceUtil/Random.cpp8
-rw-r--r--cpp/src/IceUtil/RecMutex.cpp4
-rw-r--r--cpp/src/IceUtil/Thread.cpp2
-rw-r--r--cpp/src/IceUtil/Time.cpp10
-rw-r--r--cpp/src/Makefile63
-rw-r--r--cpp/src/Slice/Makefile28
-rw-r--r--cpp/src/slice2cpp/Makefile15
-rw-r--r--cpp/src/slice2rb/Makefile14
25 files changed, 254 insertions, 85 deletions
diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp
index c7abb540a69..2a879eeaaee 100644
--- a/cpp/src/Ice/Application.cpp
+++ b/cpp/src/Ice/Application.cpp
@@ -141,7 +141,7 @@ destroyOnInterruptCallback(int signal)
//
return;
}
- if(_nohup && signal == SIGHUP)
+ if(_nohup && signal == static_cast<int>(SIGHUP))
{
return;
}
@@ -197,7 +197,7 @@ shutdownOnInterruptCallback(int signal)
//
return;
}
- if(_nohup && signal == SIGHUP)
+ if(_nohup && signal == static_cast<int>(SIGHUP))
{
return;
}
diff --git a/cpp/src/Ice/Makefile b/cpp/src/Ice/Makefile
index 150f27d89e6..e95f66163da 100644
--- a/cpp/src/Ice/Makefile
+++ b/cpp/src/Ice/Makefile
@@ -9,11 +9,17 @@
top_srcdir = ../..
-LIBFILENAME = $(call mklibfilename,Ice,$(VERSION))
-SONAME = $(call mksoname,Ice,$(SOVERSION))
-LIBNAME = $(call mklibname,Ice)
-
-TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))
+include $(top_srcdir)/config/Make.rules.common
+
+ifeq ($(MinGW), yes)
+ DLLNAME = $(top_srcdir)/bin/ice$(COMPSUFFIX)$(SOVERSION)$(LIBSUFFIX).dll
+ TARGETS = $(DLLNAME) $(LIBNAME)
+else
+ LIBFILENAME = $(call mklibfilename,Ice,$(VERSION))
+ SONAME = $(call mksoname,Ice,$(SOVERSION))
+ LIBNAME = $(call mklibname,Ice)
+ TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))
+endif
OBJS = Acceptor.o \
Application.o \
@@ -95,8 +101,7 @@ OBJS = Acceptor.o \
Stats.o \
StreamI.o \
Stream.o \
- StringConverter.o \
- SysLoggerI.o \
+ StringConverter.o \
TcpAcceptor.o \
TcpConnector.o \
TcpEndpointI.o \
@@ -109,6 +114,12 @@ OBJS = Acceptor.o \
UdpEndpointI.o \
UdpTransceiver.o
+ifneq ($(MinGW), yes)
+OBJS := $(OBJS) \
+ SysLoggerI.o
+endif
+
+
SRCS = $(OBJS:.o=.cpp) \
DLLMain.cpp
@@ -156,8 +167,16 @@ include $(top_srcdir)/config/Make.rules
CPPFLAGS := -I.. $(CPPFLAGS) -DICE_API_EXPORTS $(BZIP2_FLAGS)
SLICE2CPPFLAGS := --ice --include-dir Ice --dll-export ICE_API $(SLICE2CPPFLAGS)
+ifeq ($(MinGW), yes)
+CPPFLAGS := $(CPPFLAGS) -DCOMPSUFFIX=\"$(COMPSUFFIX)\"
+LINKWITH := $(ICE_OS_LIBS) -l$(ICEUTIL_LIBNAME) $(BZIP2_LIBS)
+$(DLLNAME): $(OBJS)
+ $(CXX) -shared $(LDFLAGS) -o $(DLLNAME) $(OBJS) $(LINKWITH)
+
+install:: all
+ $(call installprogram,$(DLLNAME),$(install_bindir))
+else
LINKWITH := -lIceUtil $(BZIP2_LIBS) $(ICONV_LIBS) $(ICE_OS_LIBS)
-
$(libdir)/$(LIBFILENAME): $(OBJS)
rm -f $@
$(call mkshlib,$@,$(SONAME),$(OBJS),$(LINKWITH))
@@ -172,6 +191,7 @@ $(libdir)/$(LIBNAME): $(libdir)/$(SONAME)
install:: all
$(call installlib,$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME))
+endif
$(HDIR)/BuiltinSequences.h BuiltinSequences.cpp: $(SDIR)/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB)
rm -f $(HDIR)/BuiltinSequences.h BuiltinSequences.cpp
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index ed730a8bb88..c29cd00a78b 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -2277,7 +2277,7 @@ IceInternal::doFinishConnectAsync(SOCKET fd, AsyncInfo& info)
// failure to connect. The socket isn't closed by this method.
//
- if(info.count == SOCKET_ERROR)
+ if(static_cast<int>(info.count) == SOCKET_ERROR)
{
WSASetLastError(info.error);
if(connectionRefused())
diff --git a/cpp/src/Ice/Network.h b/cpp/src/Ice/Network.h
index b8e30a34876..1643c5eae8f 100644
--- a/cpp/src/Ice/Network.h
+++ b/cpp/src/Ice/Network.h
@@ -24,7 +24,9 @@
#elif defined(_WIN32)
# include <winsock2.h>
# include <ws2tcpip.h>
+# if !defined(__MINGW32__)
typedef int ssize_t;
+# endif
#else
# include <unistd.h>
# include <fcntl.h>
@@ -85,6 +87,21 @@ typedef int socklen_t;
# define NETDB_SUCCESS 0
#endif
+#if defined(__MINGW32__) && !defined WSAID_CONNECTEX
+# define WSAID_CONNECTEX {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}}
+# define WSAID_ACCEPTEX {0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}}
+# define SO_UPDATE_ACCEPT_CONTEXT 0x700B
+# define SO_UPDATE_CONNECT_CONTEXT 0x7010
+ typedef BOOL (PASCAL FAR * LPFN_CONNECTEX) (IN SOCKET s, IN const struct sockaddr FAR *name, IN int namelen,
+ IN PVOID lpSendBuffer OPTIONAL, IN DWORD dwSendDataLength,
+ OUT LPDWORD lpdwBytesSent, IN LPOVERLAPPED lpOverlapped);
+
+ typedef BOOL (PASCAL FAR * LPFN_ACCEPTEX)(IN SOCKET sListenSocket, IN SOCKET sAcceptSocket,
+ IN PVOID lpOutputBuffer, IN DWORD dwReceiveDataLength,
+ IN DWORD dwLocalAddressLength, IN DWORD dwRemoteAddressLength,
+ OUT LPDWORD lpdwBytesReceived, IN LPOVERLAPPED lpOverlapped);
+#endif
+
namespace IceInternal
{
diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp
index 3c5c8df8f85..196e31ae6b7 100644
--- a/cpp/src/Ice/Service.cpp
+++ b/cpp/src/Ice/Service.cpp
@@ -852,7 +852,16 @@ Ice::Service::main(int argc, char* const argv[], const InitializationData& initi
int
Ice::Service::main(int& argc, wchar_t* argv[], const InitializationData& initializationData)
{
+
+# ifdef __MINGW32__ // COMPILER FIX
+ //
+ // MinGW doesn't see the main overload if we don't create the temp args object here.
+ //
+ Ice::StringSeq args = Ice::argsToStringSeq(argc, argv, initializationData.stringConverter);
+ return main(args, initializationData);
+# else
return main(Ice::argsToStringSeq(argc, argv, initializationData.stringConverter), initializationData);
+# endif
}
#endif
diff --git a/cpp/src/Ice/StringConverter.cpp b/cpp/src/Ice/StringConverter.cpp
index f8e385e7a23..35269b6cf23 100644
--- a/cpp/src/Ice/StringConverter.cpp
+++ b/cpp/src/Ice/StringConverter.cpp
@@ -16,10 +16,15 @@
#include <Ice/LocalException.h>
#include <Ice/LoggerUtil.h>
#include <Ice/Communicator.h>
+
#ifndef _WIN32
#include <Ice/IconvStringConverter.h>
#endif
+#ifdef __MINGW32__
+# include <limits.h>
+#endif
+
using namespace IceUtil;
using namespace IceUtilInternal;
using namespace std;
diff --git a/cpp/src/Ice/TcpAcceptor.cpp b/cpp/src/Ice/TcpAcceptor.cpp
index 0fc4fbc710c..8453863a25b 100644
--- a/cpp/src/Ice/TcpAcceptor.cpp
+++ b/cpp/src/Ice/TcpAcceptor.cpp
@@ -126,7 +126,7 @@ IceInternal::TcpAcceptor::startAccept()
void
IceInternal::TcpAcceptor::finishAccept()
{
- if(_info.count == SOCKET_ERROR || _fd == INVALID_SOCKET)
+ if(static_cast<int>(_info.count) == SOCKET_ERROR || _fd == INVALID_SOCKET)
{
closeSocketNoThrow(_acceptFd);
_acceptFd = INVALID_SOCKET;
diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp
index 3d59ae68bf1..61fda069922 100644
--- a/cpp/src/Ice/TcpTransceiver.cpp
+++ b/cpp/src/Ice/TcpTransceiver.cpp
@@ -313,7 +313,7 @@ IceInternal::TcpTransceiver::finishWrite(Buffer& buf)
return;
}
- if(_write.count == SOCKET_ERROR)
+ if(static_cast<int>(_write.count) == SOCKET_ERROR)
{
WSASetLastError(_write.error);
if(connectionLost())
@@ -385,7 +385,7 @@ IceInternal::TcpTransceiver::startRead(Buffer& buf)
void
IceInternal::TcpTransceiver::finishRead(Buffer& buf)
{
- if(_read.count == SOCKET_ERROR)
+ if(static_cast<int>(_read.count) == SOCKET_ERROR)
{
WSASetLastError(_read.error);
if(connectionLost())
diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h
index 5d45363a494..e46f244dce1 100644
--- a/cpp/src/Ice/ThreadPool.h
+++ b/cpp/src/Ice/ThreadPool.h
@@ -337,7 +337,7 @@ public:
// of the event handler. We need to lock the event handler here to call
// finishMessage.
//
-#if (defined(_MSC_VER) && (_MSC_VER < 1300))
+#if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER < 1300))
IceUtil::LockT<T> sync(_mutex);
#else
IceUtil::LockT<typename T> sync(_mutex);
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index 855527b144d..b1aa39ddd96 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -545,7 +545,7 @@ IceInternal::UdpTransceiver::finishWrite(Buffer& buf)
return;
}
- if(_write.count == SOCKET_ERROR)
+ if(static_cast<int>(_write.count) == SOCKET_ERROR)
{
#ifndef ICE_OS_WINRT
WSASetLastError(_write.error);
@@ -675,7 +675,7 @@ IceInternal::UdpTransceiver::finishRead(Buffer& buf)
checkErrorCode(__FILE__, __LINE__, ex->HResult);
}
#else
- if(_read.count == SOCKET_ERROR)
+ if(static_cast<int>(_read.count) == SOCKET_ERROR)
{
WSASetLastError(_read.error);
diff --git a/cpp/src/IceSSL/AcceptorI.cpp b/cpp/src/IceSSL/AcceptorI.cpp
index 96fc56f2d19..f1b45d6afc7 100644
--- a/cpp/src/IceSSL/AcceptorI.cpp
+++ b/cpp/src/IceSSL/AcceptorI.cpp
@@ -132,7 +132,7 @@ IceSSL::AcceptorI::startAccept()
void
IceSSL::AcceptorI::finishAccept()
{
- if(_info.count == SOCKET_ERROR || _fd == INVALID_SOCKET)
+ if(static_cast<int>(_info.count) == SOCKET_ERROR || _fd == INVALID_SOCKET)
{
IceInternal::closeSocketNoThrow(_acceptFd);
_acceptFd = INVALID_SOCKET;
diff --git a/cpp/src/IceSSL/Makefile b/cpp/src/IceSSL/Makefile
index 868cdb0acaa..ab2d6ca690b 100644
--- a/cpp/src/IceSSL/Makefile
+++ b/cpp/src/IceSSL/Makefile
@@ -10,11 +10,17 @@
top_srcdir = ../..
-LIBFILENAME = $(call mklibfilename,IceSSL,$(VERSION))
-SONAME = $(call mksoname,IceSSL,$(SOVERSION))
-LIBNAME = $(call mklibname,IceSSL)
-
-TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))
+include $(top_srcdir)/config/Make.rules.common
+
+ifeq ($(MinGW), yes)
+ DLLNAME = $(top_srcdir)/bin/icessl$(COMPSUFFIX)$(SOVERSION)$(LIBSUFFIX).dll
+ TARGETS = $(DLLNAME) $(LIBNAME)
+else
+ LIBFILENAME = $(call mklibfilename,IceSSL,$(VERSION))
+ SONAME = $(call mksoname,IceSSL,$(SOVERSION))
+ LIBNAME = $(call mklibname,IceSSL)
+ TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))
+endif
OBJS = AcceptorI.o \
Certificate.o \
@@ -42,6 +48,17 @@ include $(top_srcdir)/config/Make.rules
CPPFLAGS := -I.. $(CPPFLAGS) -DICE_SSL_API_EXPORTS $(OPENSSL_FLAGS)
SLICE2CPPFLAGS := --ice --include-dir IceSSL --dll-export ICE_SSL_API $(SLICE2CPPFLAGS)
+ifeq ($(MinGW), yes)
+
+LINKWITH := -lice$(COMPSUFFIX)$(SOVERSION)$(LIBSUFFIX) -liceutil$(COMPSUFFIX)$(SOVERSION)$(LIBSUFFIX) $(ICE_OS_LIBS) $(OPENSSL_LIBS)
+
+$(DLLNAME): $(OBJS)
+ $(CXX) -shared $(LDFLAGS) -o $(DLLNAME) $(OBJS) $(LINKWITH)
+
+install:: all
+ $(call installprogram,$(DLLNAME),$(install_bindir))
+
+else
LINKWITH := $(BZIP2_RPATH_LINK) -lIce -lIceUtil $(OPENSSL_LIBS) $(CXXLIBS)
$(libdir)/$(LIBFILENAME): $(OBJS)
@@ -58,5 +75,6 @@ $(libdir)/$(LIBNAME): $(libdir)/$(SONAME)
install:: all
$(call installlib,$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME))
+endif
include .depend
diff --git a/cpp/src/IceSSL/TransceiverI.cpp b/cpp/src/IceSSL/TransceiverI.cpp
index 3c75c6331bc..a052fbd8f00 100644
--- a/cpp/src/IceSSL/TransceiverI.cpp
+++ b/cpp/src/IceSSL/TransceiverI.cpp
@@ -692,7 +692,7 @@ IceSSL::TransceiverI::finishWrite(IceInternal::Buffer& buf)
return;
}
- if(_write.count == SOCKET_ERROR)
+ if(static_cast<int>(_write.count) == SOCKET_ERROR)
{
WSASetLastError(_write.error);
if(IceInternal::connectionLost())
@@ -763,7 +763,7 @@ IceSSL::TransceiverI::startRead(IceInternal::Buffer& buf)
void
IceSSL::TransceiverI::finishRead(IceInternal::Buffer& buf)
{
- if(_read.count == SOCKET_ERROR)
+ if(static_cast<int>(_read.count) == SOCKET_ERROR)
{
WSASetLastError(_read.error);
if(IceInternal::connectionLost())
diff --git a/cpp/src/IceUtil/Exception.cpp b/cpp/src/IceUtil/Exception.cpp
index 350df152b29..fac85e5e01e 100644
--- a/cpp/src/IceUtil/Exception.cpp
+++ b/cpp/src/IceUtil/Exception.cpp
@@ -14,7 +14,7 @@
#include <ostream>
#include <cstdlib>
-#if defined(__GNUC__) && !defined(__sun) && !defined(__FreeBSD__)
+#if defined(__GNUC__) && !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__)
# include <execinfo.h>
# include <cxxabi.h>
#endif
@@ -52,7 +52,7 @@ public:
Init init;
-#if defined(__GNUC__) && !defined(__sun) && !defined(__FreeBSD__)
+#if defined(__GNUC__) && !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__)
string
getStackTrace()
{
@@ -183,7 +183,7 @@ getStackTrace()
IceUtil::Exception::Exception() :
_file(0),
_line(0)
-#if defined(__GNUC__) && !defined(__sun) && !defined(__FreeBSD__)
+#if defined(__GNUC__) && !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__)
, _stackTrace(getStackTrace())
#endif
{
@@ -192,7 +192,7 @@ IceUtil::Exception::Exception() :
IceUtil::Exception::Exception(const char* file, int line) :
_file(file),
_line(line)
-#if defined(__GNUC__) && !defined(__sun) && !defined(__FreeBSD__)
+#if defined(__GNUC__) && !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__)
, _stackTrace(getStackTrace())
#endif
{
diff --git a/cpp/src/IceUtil/FileUtil.cpp b/cpp/src/IceUtil/FileUtil.cpp
index 0888ff8281c..b69e8d6b20a 100644
--- a/cpp/src/IceUtil/FileUtil.cpp
+++ b/cpp/src/IceUtil/FileUtil.cpp
@@ -170,7 +170,7 @@ IceUtilInternal::unlink(const string& path)
int
IceUtilInternal::close(int fd)
{
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+#if defined(_MSC_VER) && (_MSC_VER >= 1400) || defined(__MINGW32__)
return _close(fd);
#else
return ::close(fd);
@@ -197,6 +197,12 @@ IceUtilInternal::FileLock::FileLock(const std::string& path) :
throw IceUtil::FileLockException(__FILE__, __LINE__, GetLastError(), _path);
}
+#ifdef __MINGW32__
+ if(::LockFile(_fd, 0, 0, 0, 0) == 0)
+ {
+ throw IceUtil::FileLockException(__FILE__, __LINE__, GetLastError(), _path);
+ }
+#else
OVERLAPPED overlaped;
overlaped.Internal = 0;
overlaped.InternalHigh = 0;
@@ -208,6 +214,7 @@ IceUtilInternal::FileLock::FileLock(const std::string& path) :
::CloseHandle(_fd);
throw IceUtil::FileLockException(__FILE__, __LINE__, GetLastError(), _path);
}
+#endif
//
// In Windows implementation we don't write the process pid to the file, as is
// not posible to read the file from other process while it is locked here.
@@ -310,14 +317,23 @@ IceUtilInternal::ifstream::open(const string& path, ios_base::openmode mode)
#else
-IceUtilInternal::ifstream::ifstream(const string& path, ios_base::openmode mode) : std::ifstream(IceUtil::stringToWstring(path).c_str(), mode)
+IceUtilInternal::ifstream::ifstream(const string& path, ios_base::openmode mode) :
+#ifdef __MINGW32__
+ std::ifstream(path.c_str(), mode)
+#else
+ std::ifstream(IceUtil::stringToWstring(path).c_str(), mode)
+#endif
{
}
void
IceUtilInternal::ifstream::open(const string& path, ios_base::openmode mode)
{
+#ifdef __MINGW32__
+ std::ifstream::open(path.c_str(), mode);
+#else
std::ifstream::open(IceUtil::stringToWstring(path).c_str(), mode);
+#endif
}
#endif
@@ -371,14 +387,23 @@ IceUtilInternal::ofstream::open(const string& path, ios_base::openmode mode)
#else
-IceUtilInternal::ofstream::ofstream(const string& path, ios_base::openmode mode) : std::ofstream(IceUtil::stringToWstring(path).c_str(), mode)
+IceUtilInternal::ofstream::ofstream(const string& path, ios_base::openmode mode) :
+#ifdef __MINGW32__
+ std::ofstream(path.c_str(), mode)
+#else
+ std::ofstream(IceUtil::stringToWstring(path).c_str(), mode)
+#endif
{
}
void
IceUtilInternal::ofstream::open(const string& path, ios_base::openmode mode)
{
+#ifdef __MINGW32__
+ std::ofstream::open(path.c_str(), mode);
+#else
std::ofstream::open(IceUtil::stringToWstring(path).c_str(), mode);
+#endif
}
#endif
diff --git a/cpp/src/IceUtil/InputUtil.cpp b/cpp/src/IceUtil/InputUtil.cpp
index 1b29658afbe..8f5edab81f9 100644
--- a/cpp/src/IceUtil/InputUtil.cpp
+++ b/cpp/src/IceUtil/InputUtil.cpp
@@ -11,7 +11,7 @@
#include <stdlib.h>
#include <errno.h>
-#if defined(_MSC_VER) && (_MSC_VER < 1300)
+#if (defined(_MSC_VER) && (_MSC_VER < 1300) ) || (__MINGW32__)
#include <limits.h>
#endif
@@ -25,7 +25,9 @@ using namespace IceUtil;
namespace IceUtilInternal
{
-#if (defined(_MSC_VER) && (_MSC_VER < 1300))
+
+#if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER < 1300))
+
//
// The VC60 runtime does not include _strtoi64, so we provide our own implementation
//
@@ -177,7 +179,7 @@ Int64
strToInt64(const char* s, char** endptr, int base)
{
#if defined(_WIN32)
-# if (defined(_MSC_VER) && (_MSC_VER < 1300))
+# if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER < 1300))
return strToInt64Impl(s, endptr, base);
# else
return _strtoi64(s, endptr, base);
diff --git a/cpp/src/IceUtil/Makefile b/cpp/src/IceUtil/Makefile
index 4fb25718adf..a3e19c0914f 100644
--- a/cpp/src/IceUtil/Makefile
+++ b/cpp/src/IceUtil/Makefile
@@ -9,11 +9,17 @@
top_srcdir = ../..
-LIBFILENAME = $(call mklibfilename,IceUtil,$(VERSION))
-SONAME = $(call mksoname,IceUtil,$(SOVERSION))
-LIBNAME = $(call mklibname,IceUtil)
+include $(top_srcdir)/config/Make.rules.common
-TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))
+ifeq ($(MinGW), yes)
+ DLLNAME = $(top_srcdir)/bin/iceutil$(COMPSUFFIX)$(SOVERSION)$(LIBSUFFIX).dll
+ TARGETS = $(DLLNAME) $(LIBNAME)
+else
+ LIBFILENAME = $(call mklibfilename,IceUtil,$(VERSION))
+ SONAME = $(call mksoname,IceUtil,$(SOVERSION))
+ LIBNAME = $(call mklibname,IceUtil)
+ TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))
+endif
OBJS = ArgVector.o \
Cond.o \
@@ -21,7 +27,6 @@ OBJS = ArgVector.o \
CountDownLatch.o \
CtrlCHandler.o \
Exception.o \
- FileUtil.o \
InputUtil.o \
Options.o \
OutputUtil.o \
@@ -35,7 +40,8 @@ OBJS = ArgVector.o \
Timer.o \
UUID.o \
Unicode.o \
- MutexProtocol.o
+ MutexProtocol.o \
+ FileUtil.o
SRCS = $(OBJS:.o=.cpp)
@@ -43,8 +49,15 @@ include $(top_srcdir)/config/Make.rules
CPPFLAGS := $(CPPFLAGS) $(ICEUTIL_FLAGS) -DICE_UTIL_API_EXPORTS -I..
-LINKWITH := $(STLPORT_LIBS) $(ICEUTIL_OS_LIBS)
+LINKWITH := $(ICEUTIL_OS_LIBS)
+ifeq ($(MinGW), yes)
+$(DLLNAME): $(OBJS)
+ $(CXX) -shared $(LDFLAGS) -o $(DLLNAME) $(OBJS) $(LINKWITH)
+
+install:: all
+ $(call installprogram,$(DLLNAME),$(install_bindir))
+else
ifeq ($(STATICLIBS),yes)
$(libdir)/$(LIBNAME): $(OBJS)
rm -f $@
@@ -62,9 +75,9 @@ $(libdir)/$(LIBNAME): $(libdir)/$(SONAME)
rm -f $@
ln -s $(SONAME) $@
endif
-
install:: all
$(call installlib,$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME))
+endif
include .depend
diff --git a/cpp/src/IceUtil/Random.cpp b/cpp/src/IceUtil/Random.cpp
index e82a55d93ab..d47d424357f 100644
--- a/cpp/src/IceUtil/Random.cpp
+++ b/cpp/src/IceUtil/Random.cpp
@@ -44,7 +44,7 @@ namespace
//
Mutex* staticMutex = 0;
#ifdef _WIN32
-HCRYPTPROV context = NULL;
+HCRYPTPROV context = 0;
#else
int fd = -1;
#endif
@@ -61,10 +61,10 @@ public:
~Init()
{
#ifdef _WIN32
- if(context != NULL)
+ if(context != 0)
{
CryptReleaseContext(context, 0);
- context = NULL;
+ context = 0;
}
#else
if(fd != -1)
@@ -102,7 +102,7 @@ IceUtilInternal::generateRandom(char* buffer, int size)
//
IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(staticMutex);
- if(context == NULL)
+ if(context == 0)
{
if(!CryptAcquireContext(&context, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
{
diff --git a/cpp/src/IceUtil/RecMutex.cpp b/cpp/src/IceUtil/RecMutex.cpp
index c632f4b7b63..9558a6fed2b 100644
--- a/cpp/src/IceUtil/RecMutex.cpp
+++ b/cpp/src/IceUtil/RecMutex.cpp
@@ -33,7 +33,11 @@ IceUtil::RecMutex::RecMutex(const IceUtil::MutexProtocol protocol) :
void
IceUtil::RecMutex::init(const MutexProtocol)
{
+# ifdef ICE_OS_WINRT
InitializeCriticalSectionEx(&_mutex, 0, 0);
+# else
+ InitializeCriticalSection(&_mutex);
+# endif
}
IceUtil::RecMutex::~RecMutex()
diff --git a/cpp/src/IceUtil/Thread.cpp b/cpp/src/IceUtil/Thread.cpp
index a629586a43b..4c63bd7b0e2 100644
--- a/cpp/src/IceUtil/Thread.cpp
+++ b/cpp/src/IceUtil/Thread.cpp
@@ -251,7 +251,7 @@ IceUtil::Thread::start(size_t stackSize, int priority)
{
throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
- if(ResumeThread(_handle) == -1)
+ if(static_cast<int>(ResumeThread(_handle)) == -1)
{
__decRef();
throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
diff --git a/cpp/src/IceUtil/Time.cpp b/cpp/src/IceUtil/Time.cpp
index 585335191e8..bef48d9ab3d 100644
--- a/cpp/src/IceUtil/Time.cpp
+++ b/cpp/src/IceUtil/Time.cpp
@@ -95,8 +95,13 @@ IceUtil::Time::now(Clock clock)
if(clock == Realtime)
{
#ifdef _WIN32
+# if defined(_MSC_VER)
struct _timeb tb;
_ftime(&tb);
+# elif defined(__MINGW32__)
+ struct timeb tb;
+ ftime(&tb);
+# endif
return Time(static_cast<Int64>(tb.time) * ICE_INT64(1000000) + tb.millitm * 1000);
#else
struct timeval tv;
@@ -123,8 +128,13 @@ IceUtil::Time::now(Clock clock)
}
else
{
+# if defined(_MSC_VER)
struct _timeb tb;
_ftime(&tb);
+# elif defined(__MINGW32__)
+ struct timeb tb;
+ ftime(&tb);
+# endif
return Time(static_cast<Int64>(tb.time) * ICE_INT64(1000000) + tb.millitm * 1000);
}
#elif defined(__hpux)
diff --git a/cpp/src/Makefile b/cpp/src/Makefile
index a7930b2e6ec..4917e0a96ef 100644
--- a/cpp/src/Makefile
+++ b/cpp/src/Makefile
@@ -11,33 +11,42 @@ top_srcdir = ..
include $(top_srcdir)/config/Make.rules
-SUBDIRS = IceUtil \
- Slice \
- slice2cpp \
- slice2cs \
- slice2freeze \
- slice2freezej \
- slice2java \
- slice2php \
- slice2py \
- slice2rb \
- slice2html \
- Ice \
- IceXML \
- IceSSL \
- Freeze \
- FreezeScript \
- IceBox \
- Glacier2Lib \
- Glacier2 \
- IceDB \
- IcePatch2Lib \
- IcePatch2 \
- IceStormLib \
- IceGridLib \
- IceStorm \
- IceGrid \
- ca
+ifeq ($(MinGW), yes)
+ SUBDIRS = IceUtil \
+ Slice \
+ slice2cpp \
+ slice2rb \
+ Ice \
+ IceSSL
+else
+ SUBDIRS = IceUtil \
+ Slice \
+ slice2cpp \
+ slice2cs \
+ slice2freeze \
+ slice2freezej \
+ slice2java \
+ slice2php \
+ slice2py \
+ slice2rb \
+ slice2html \
+ Ice \
+ IceXML \
+ IceSSL \
+ Freeze \
+ FreezeScript \
+ IceBox \
+ Glacier2Lib \
+ Glacier2 \
+ IceDB \
+ IcePatch2Lib \
+ IcePatch2 \
+ IceStormLib \
+ IceGridLib \
+ IceStorm \
+ IceGrid \
+ ca
+endif
$(EVERYTHING)::
@for subdir in $(SUBDIRS); \
diff --git a/cpp/src/Slice/Makefile b/cpp/src/Slice/Makefile
index c6e5718f866..f07c97d1340 100644
--- a/cpp/src/Slice/Makefile
+++ b/cpp/src/Slice/Makefile
@@ -9,11 +9,17 @@
top_srcdir = ../..
-LIBFILENAME = $(call mklibfilename,Slice,$(VERSION))
-SONAME = $(call mksoname,Slice,$(SOVERSION))
-LIBNAME = $(call mklibname,Slice)
+include $(top_srcdir)/config/Make.rules.common
-TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))
+ifeq ($(MinGW), yes)
+ DLLNAME = $(top_srcdir)/bin/slice$(COMPSUFFIX)$(SOVERSION)$(LIBSUFFIX).dll
+ TARGETS = $(DLLNAME) $(LIBNAME)
+else
+ LIBFILENAME = $(call mklibfilename,Slice,$(VERSION))
+ SONAME = $(call mksoname,Slice,$(SOVERSION))
+ LIBNAME = $(call mklibname,Slice)
+ TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))
+endif
OBJS = Scanner.o \
../Slice/Grammar.o \
@@ -36,10 +42,19 @@ SRCS = $(OBJS:.o=.cpp)
include $(top_srcdir)/config/Make.rules
+
CPPFLAGS := -I.. $(CPPFLAGS) -DSLICE_API_EXPORTS
-LINKWITH := -lIceUtil $(MCPP_LIBS)
BISONFLAGS := --name-prefix "slice_" $(BISONFLAGS)
+ifeq ($(MinGW), yes)
+LINKWITH := -l$(ICEUTIL_LIBNAME) $(MCPP_LIBS)
+$(DLLNAME): $(OBJS)
+ $(CXX) -shared $(LDFLAGS) -o $(DLLNAME) $(OBJS) $(LINKWITH)
+
+install:: all
+ $(call installprogram,$(DLLNAME),$(install_bindir))
+else
+LINKWITH := -lIceUtil $(MCPP_LIBS)
ifeq ($(STATICLIBS),yes)
$(libdir)/$(LIBNAME): $(OBJS)
rm -f $@
@@ -57,9 +72,8 @@ $(libdir)/$(LIBNAME): $(libdir)/$(SONAME)
rm -f $@
ln -s $(SONAME) $@
endif
-
install:: all
$(call installlib,$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME))
-
+endif
include .depend
diff --git a/cpp/src/slice2cpp/Makefile b/cpp/src/slice2cpp/Makefile
index dc15e514e7e..167f35e7dc8 100644
--- a/cpp/src/slice2cpp/Makefile
+++ b/cpp/src/slice2cpp/Makefile
@@ -9,7 +9,13 @@
top_srcdir = ../..
-NAME = $(top_srcdir)/bin/slice2cpp
+include $(top_srcdir)/config/Make.rules.common
+
+ifeq ($(MinGW), yes)
+ NAME = $(top_srcdir)/bin/slice2cpp.exe
+else
+ NAME = $(top_srcdir)/bin/slice2cpp
+endif
TARGETS = $(NAME)
@@ -22,10 +28,15 @@ include $(top_srcdir)/config/Make.rules
CPPFLAGS := -I. $(CPPFLAGS)
+ifeq ($(MinGW), yes)
+$(NAME): $(OBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(OBJS) -lslice$(COMPSUFFIX)$(SOVERSION)$(LIBSUFFIX) $(BASELIBS) $(MCPP_RPATH_LINK)
+else
$(NAME): $(OBJS)
rm -f $@
$(CXX) $(LDFLAGS) -o $@ $(OBJS) -lSlice $(BASELIBS) $(MCPP_RPATH_LINK)
-
+endif
install:: all
$(call installprogram,$(NAME),$(install_bindir))
diff --git a/cpp/src/slice2rb/Makefile b/cpp/src/slice2rb/Makefile
index 7e014004b32..1e4df68e074 100644
--- a/cpp/src/slice2rb/Makefile
+++ b/cpp/src/slice2rb/Makefile
@@ -9,7 +9,13 @@
top_srcdir = ../..
-NAME = $(top_srcdir)/bin/slice2rb
+include $(top_srcdir)/config/Make.rules.common
+
+ifeq ($(MinGW), yes)
+ NAME = $(top_srcdir)/bin/slice2rb.exe
+else
+ NAME = $(top_srcdir)/bin/slice2rb
+endif
TARGETS = $(NAME)
@@ -21,9 +27,15 @@ include $(top_srcdir)/config/Make.rules
CPPFLAGS := -I. $(CPPFLAGS)
+ifeq ($(MinGW), yes)
+$(NAME): $(OBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(OBJS) -lslice$(COMPSUFFIX)$(SOVERSION)$(LIBSUFFIX) $(BASELIBS) $(MCPP_RPATH_LINK)
+else
$(NAME): $(OBJS)
rm -f $@
$(CXX) $(LDFLAGS) -o $@ $(OBJS) -lSlice $(BASELIBS) $(MCPP_RPATH_LINK)
+endif
install:: all
$(call installprogram,$(NAME),$(install_bindir))