From 4b28cd18e92ace91e70820f805604bd83caf5502 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Tue, 22 Aug 2006 19:28:47 +0000 Subject: [PATCH] The master file for the Windows port. There are several big changes. One of the most important is the IOVBASE_TYPE which should be used all over the places for casting to and from the iov_base field of the iovec struct. The reason is because windows does not support any kind of implicit conversion (not even through void*). All conversions should be EXPLICIT. This commit was SVN r11328. --- opal/include/opal_config_bottom.h | 69 +++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/opal/include/opal_config_bottom.h b/opal/include/opal_config_bottom.h index 8e3d660f28..d9643d9b24 100644 --- a/opal/include/opal_config_bottom.h +++ b/opal/include/opal_config_bottom.h @@ -28,6 +28,21 @@ #error "opal_config_bottom.h should only be included from opal_config.h" #endif +/* + * If we build a static library, Visual C define the _LIB symbol. In the + * case of a shared library _USERDLL get defined. + * + * OMPI_BUILDING and _LIB define how ompi_config.h + * handles configuring all of Open MPI's "compatibility" code. Both + * constants will always be defined by the end of ompi_config.h. + * + * OMPI_BUILDING affects how much compatibility code is included by + * ompi_config.h. It will always be 1 or 0. The user can set the + * value before including either mpi.h or ompi_config.h and it will be + * respected. If ompi_config.h is included before mpi.h, it will + * default to 1. If mpi.h is included before ompi_config.h, it will + * default to 0. + */ #ifndef OMPI_BUILDING #define OMPI_BUILDING 1 #endif @@ -47,11 +62,11 @@ * Windows library interface declaration code * **********************************************************************/ -#ifndef __WINDOWS__ +#if !defined(__WINDOWS__) # if defined(_WIN32) || defined(WIN32) || defined(WIN64) # define __WINDOWS__ # endif -#endif +#endif /* !defined(__WINDOWS__) */ #if defined(__WINDOWS__) @@ -79,6 +94,21 @@ # define OPAL_MODULE_DECLSPEC #endif +/* + * Do we have ? + */ +#ifdef HAVE_STDINT_H +#if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS) +/* When using a C++ compiler, the max / min value #defines for std + types are only included if __STDC_LIMIT_MACROS is set before + including stdint.h */ +#define __STDC_LIMIT_MACROS +#endif +#include +#else +#include "opal_stdint.h" +#endif + /*********************************************************************** * * Code that is only for when building Open MPI or utilities that are @@ -140,7 +170,7 @@ typedef long long bool; #endif /* - * Set the compile-time path-separator on this system + * Set the compile-time path-separator on this system and variable separator */ #ifdef __WINDOWS__ #define OPAL_PATH_SEP "\\" @@ -150,20 +180,6 @@ typedef long long bool; #define OPAL_ENV_SEP ':' #endif -/* - * Do we have ? - */ -#ifdef HAVE_STDINT_H -#if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS) -/* When using a C++ compiler, the max / min value #defines for std - types are only included if __STDC_LIMIT_MACROS is set before - including stdint.h */ -#define __STDC_LIMIT_MACROS -#endif -#include -#else -#include "opal_stdint.h" -#endif /* * Do we want memory debugging? @@ -294,4 +310,23 @@ static inline uint16_t ntohs(uint16_t netvar) { return netvar; } #define __func__ __FILE__ #endif +/** + * Because of the way we're using the opal_object inside Open MPI (i.e. + * dynamic resolution at run-time to derive all objects from the basic + * type), on Windows we have to build everything on C++ mode, simply + * because the C mode does not support dynamic resolution in DLL. Therefore, + * no automatic conversion is allowed. All types have to be explicitly casted + * or the compiler generate an error. This is true even for the void* type. As + * we use void* to silence others compilers in the resolution of the addr member + * of the iovec structure, we have now to find a way around. The simplest solution + * is to define a special type for this field (just for casting). It can be + * set to void* on all platforms with the exception of windows where it has to be + * char*. + */ +#if defined(__WINDOWS__) +#define IOVBASE_TYPE char +#else +#define IOVBASE_TYPE void +#endif /* defined(__WINDOWS__) */ + #endif /* OMPI_BUILDING */