Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

xcontract/implicit_link.h

Go to the documentation of this file.
00001 /* /////////////////////////////////////////////////////////////////////////
00002  * File:        xcontract/implicit_link.h
00003  *
00004  * Purpose:     Implicit linking for the xContract API
00005  *
00006  * Created:     3rd March 2003
00007  * Updated:     4th July 2010
00008  *
00009  * Home:        http://xcontract.org/
00010  *
00011  * Copyright (c) 2003-2010, Matthew Wilson and Synesis Software
00012  * All rights reserved.
00013  *
00014  * Redistribution and use in source and binary forms, with or without
00015  * modification, are permitted provided that the following conditions are
00016  * met:
00017  *
00018  * - Redistributions of source code must retain the above copyright notice,
00019  *   this list of conditions and the following disclaimer.
00020  * - Redistributions in binary form must reproduce the above copyright
00021  *   notice, this list of conditions and the following disclaimer in the
00022  *   documentation and/or other materials provided with the distribution.
00023  * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
00024  *   names of any contributors may be used to endorse or promote products
00025  *   derived from this software without specific prior written permission.
00026  *
00027  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00028  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00029  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00030  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00031  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00032  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00033  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00034  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00035  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00036  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00037  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038  *
00039  * ////////////////////////////////////////////////////////////////////// */
00040 
00041 
00054 #ifndef XCONTRACT_INCL_XCONTRACT_H_IMPLICIT_LINK
00055 #define XCONTRACT_INCL_XCONTRACT_H_IMPLICIT_LINK
00056 
00057 /* /////////////////////////////////////////////////////////////////////////
00058  * Version information
00059  */
00060 
00061 #ifndef XCONTRACT_DOCUMENTATION_SKIP_SECTION
00062 # define XCONTRACT_VER_XCONTRACT_H_IMPLICIT_LINK_MAJOR      1
00063 # define XCONTRACT_VER_XCONTRACT_H_IMPLICIT_LINK_MINOR      4
00064 # define XCONTRACT_VER_XCONTRACT_H_IMPLICIT_LINK_REVISION   1
00065 # define XCONTRACT_VER_XCONTRACT_H_IMPLICIT_LINK_EDIT       26
00066 #endif /* !XCONTRACT_DOCUMENTATION_SKIP_SECTION */
00067 
00068 /* /////////////////////////////////////////////////////////////////////////
00069  * Includes
00070  */
00071 
00072 #ifndef XCONTRACT_INCL_XCONTRACT_H_XCONTRACT
00073 # include <xcontract/xcontract.h>
00074 #endif /* !XCONTRACT_INCL_XCONTRACT_H_XCONTRACT */
00075 
00076 /* /////////////////////////////////////////////////////////////////////////
00077  * Macros and definitions
00078  */
00079 
00080 #  define XCONTRACT_IMPL_LINK_STRINGIZE_2_(x)   #x
00081 #  define XCONTRACT_IMPL_LINK_STRINGIZE_1_(x)   XCONTRACT_IMPL_LINK_STRINGIZE_2_(x)
00082 
00083 /* /////////////////////////////////////////////////////////////////////////
00084  * Implicit linking
00085  */
00086 
00087 #if defined(_WIN32) || \
00088     defined(_WIN64)
00089 
00090 # if defined(__BORLANDC__) || \
00091      /* defined(__DMC__) || */ \
00092      defined(__INTEL_COMPILER) || \
00093      defined(__MWERKS__) || \
00094      defined(_MSC_VER)
00095 #  if !defined(__COMO__)
00096 #   define XCONTRACT_IMPLICIT_LINK_SUPPORT
00097 #  endif /* compiler */
00098 # endif /* compiler */
00099 
00100 #if defined(XCONTRACT_IMPLICIT_LINK_SUPPORT) && \
00101     defined(XCONTRACT_NO_IMPLICIT_LINK)
00102 # undef XCONTRACT_IMPLICIT_LINK_SUPPORT
00103 #endif /* XCONTRACT_IMPLICIT_LINK_SUPPORT && XCONTRACT_NO_IMPLICIT_LINK */
00104 
00105 # if defined(XCONTRACT_IMPLICIT_LINK_SUPPORT)
00106 
00107   /* prefix */
00108 
00109 #  define XCONTRACT_IMPL_LINK_PREFIX
00110 
00111   /* library basename */
00112 
00113 #  define XCONTRACT_IMPL_LINK_LIBRARY_BASENAME          "xcontract"
00114 
00115   /* major version */
00116 
00117 #  define XCONTRACT_IMPL_LINK_MAJOR_VERSION             "." XCONTRACT_IMPL_LINK_STRINGIZE_1_(XCONTRACT_VER_MAJOR)
00118 
00119   /* module name */
00120 
00121 #  define XCONTRACT_IMPL_LINK_MODULE_NAME               ".core"
00122 
00123   /* compiler tag */
00124 
00125 #  if defined(__BORLANDC__)
00126 #   if __BORLANDC__ == 0x0550
00127 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "bc55"
00128 #   elif (__BORLANDC__ == 0x0551)
00129 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "bc551"
00130 #   elif (__BORLANDC__ == 0x0560)
00131 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "bc56"
00132 #   elif (__BORLANDC__ == 0x0564)
00133 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "bc564"
00134 #   elif (__BORLANDC__ == 0x0582)
00135 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "bc582"
00136 #   elif (0x0590 == (__BORLANDC__ & 0xfff0))
00137 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "bc59x"
00138 #   elif (0x0610 == (__BORLANDC__ & 0xfff0))
00139 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "bc61x"
00140 #   else /* ? __BORLANDC__ */
00141 #    error Unrecognised value of __BORLANDC__
00142 #   endif /* __BORLANDC__ */
00143 
00144 /*
00145 #  elif defined(__DMC__)
00146 #   define XCONTRACT_IMPL_LINK_COMPILER_NAME            "dm"
00147  */
00148 
00149 #  elif defined(__INTEL_COMPILER)
00150 #   if (__INTEL_COMPILER == 600)
00151 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "icl6"
00152 #   elif (__INTEL_COMPILER == 700)
00153 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "icl7"
00154 #   elif (__INTEL_COMPILER == 800)
00155 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "icl8"
00156 #   elif (__INTEL_COMPILER == 900)
00157 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "icl9"
00158 #   elif (__INTEL_COMPILER == 1000)
00159 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "icl10"
00160 #   elif (__INTEL_COMPILER == 1100)
00161 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "icl11"
00162 #   else /* ? __INTEL_COMPILER */
00163 #    error Unrecognised value of __INTEL_COMPILER
00164 #   endif /* __INTEL_COMPILER */
00165 
00166 #  elif defined(__MWERKS__)
00167 #   if ((__MWERKS__ & 0xFF00) == 0x2400)
00168 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "cw7"
00169 #   elif ((__MWERKS__ & 0xFF00) == 0x3000)
00170 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "cw8"
00171 #   elif ((__MWERKS__ & 0xFF00) == 0x3200)
00172 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "cw9"
00173 #   else /* ? __MWERKS__ */
00174 #    error Unrecognised value of __MWERKS__
00175 #   endif /* __MWERKS__ */
00176 
00177 #  elif defined(_MSC_VER)
00178 #   if _MSC_VER == 1000
00179 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "vc4"
00180 #   elif _MSC_VER == 1020
00181 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "vc42"
00182 #   elif _MSC_VER == 1100
00183 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "vc5"
00184 #   elif _MSC_VER == 1200
00185 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "vc6"
00186 #   elif _MSC_VER == 1300
00187 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "vc7"
00188 #   elif _MSC_VER == 1310
00189 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "vc71"
00190 #   elif _MSC_VER == 1400
00191 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "vc8"
00192 #   elif _MSC_VER == 1500
00193 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "vc9"
00194 #   elif _MSC_VER == 1600
00195 #    define XCONTRACT_IMPL_LINK_COMPILER_NAME           "vc10"
00196 #   else /* ? _MSC_VER */
00197 #    error Unrecognised value of _MSC_VER
00198 #   endif /* _MSC_VER */
00199 
00200 #  else /* ? compiler */
00201 #   error Unrecognised compiler
00202 #  endif /* compiler */
00203 
00204 
00205   /* operating system tag */
00206 
00207 #  if defined(_STLSOFT_FORCE_ANY_COMPILER) && \
00208       defined(PLATFORMSTL_OS_IS_UNIX) && \
00209       defined(_WIN32)
00210 #   define XCONTRACT_IMPL_LINK_OS_TAG                   ".unix"
00211 #  endif /* pseudo UNIX */
00212 
00213 #  if !defined(XCONTRACT_IMPL_LINK_OS_TAG)
00214 #   define XCONTRACT_IMPL_LINK_OS_TAG                   ""
00215 #  endif /* !XCONTRACT_IMPL_LINK_OS_TAG */
00216 
00217 
00218   /* architecture tag */
00219 
00220 #  if defined(PLATFORMSTL_ARCH_IS_X86)
00221 #   define XCONTRACT_IMPL_LINK_ARCH_TAG                 ""
00222 #  elif defined(PLATFORMSTL_ARCH_IS_X64)
00223 #   define XCONTRACT_IMPL_LINK_ARCH_TAG                 ".x64"
00224 #  elif defined(PLATFORMSTL_ARCH_IS_IA64)
00225 #   define XCONTRACT_IMPL_LINK_ARCH_TAG                 ".ia64"
00226 #  endif /* arch */
00227 
00228 #  if !defined(XCONTRACT_IMPL_LINK_ARCH_TAG)
00229 #   define XCONTRACT_IMPL_LINK_ARCH_TAG                 ""
00230 #  endif /* !XCONTRACT_IMPL_LINK_ARCH_TAG */
00231 
00232 
00233   /* encoding tag */
00234 
00235 #  if defined(XCONTRACT_USE_WIDE_STRINGS)
00236 #   define XCONTRACT_IMPL_LINK_ENCODING_TAG             ".widestring"
00237 #  else /* ? XCONTRACT_USE_WIDE_STRINGS */
00238 #   define XCONTRACT_IMPL_LINK_ENCODING_TAG             ""
00239 #  endif /* XCONTRACT_USE_WIDE_STRINGS */
00240 
00241 
00242   /* threading tag */
00243 
00244 # if defined(__MT__) || \
00245      defined(_REENTRANT) || \
00246      defined(_MT)
00247 #  if defined(_DLL) || \
00248       defined(__DLL)
00249 #   define XCONTRACT_IMPL_LINK_THREADING_TAG            ".dll"
00250 #  else /* ? dll */
00251 #   define XCONTRACT_IMPL_LINK_THREADING_TAG            ".mt"
00252 #  endif /* dll */
00253 # else /* ? mt */
00254 #   define XCONTRACT_IMPL_LINK_THREADING_TAG            ""
00255 # endif /* mt */
00256 
00257 
00258   /* NoX */
00259 
00260 #  if defined(XCONTRACT_CF_NOX)
00261 #   define XCONTRACT_IMPL_LINK_NOX_TYPE                 ".nox"
00262 #  else /* ? XCONTRACT_CF_NOX */
00263 #   define XCONTRACT_IMPL_LINK_NOX_TYPE                 ""
00264 #  endif /* XCONTRACT_CF_NOX */
00265 
00266 
00267   /* debug tag */
00268 
00269 # if defined(XCONTRACT_VARIANT_TEST)
00270 #  define XCONTRACT_IMPL_LINK_DEBUG_TYPE                ".test"
00271 # elif !defined(NDEBUG) && \
00272       defined(_DEBUG)
00273 #   define XCONTRACT_IMPL_LINK_DEBUG_TAG                ".debug"
00274 #  else /* ? debug */
00275 #   define XCONTRACT_IMPL_LINK_DEBUG_TAG                ""
00276 #  endif /* debug */
00277 
00278 
00279   /* suffix */
00280 
00281 #  define XCONTRACT_IMPL_LINK_SUFFIX                    ".lib"
00282 
00283 
00284    /* Library name is:
00285     *
00286     * [lib]<library-basename>.<major-version>.<module-name>.<compiler-name>[.<os-arch-tag>][.<char-encoding-tag>][.<threading-tag>][.<nox-tag>][.<debug-tag>].{a|lib}
00287     */
00288 
00289 #  define XCONTRACT_IMPL_LINK_LIBRARY_NAME              XCONTRACT_IMPL_LINK_PREFIX \
00290                                                         XCONTRACT_IMPL_LINK_LIBRARY_BASENAME \
00291                                                         XCONTRACT_IMPL_LINK_MAJOR_VERSION \
00292                                                         XCONTRACT_IMPL_LINK_MODULE_NAME \
00293                                                         "." XCONTRACT_IMPL_LINK_COMPILER_NAME \
00294                                                         XCONTRACT_IMPL_LINK_OS_TAG \
00295                                                         XCONTRACT_IMPL_LINK_ARCH_TAG \
00296                                                         XCONTRACT_IMPL_LINK_ENCODING_TAG \
00297                                                         XCONTRACT_IMPL_LINK_THREADING_TAG \
00298                                                         XCONTRACT_IMPL_LINK_NOX_TYPE \
00299                                                         XCONTRACT_IMPL_LINK_DEBUG_TAG \
00300                                                         XCONTRACT_IMPL_LINK_SUFFIX
00301 
00302 
00303 #  pragma message("lib: " XCONTRACT_IMPL_LINK_LIBRARY_NAME)
00304 
00305 #  pragma comment(lib, XCONTRACT_IMPL_LINK_LIBRARY_NAME)
00306 
00307 # endif /* XCONTRACT_IMPLICIT_LINK_SUPPORT */
00308 
00309 #endif /* Win-32 || Win-64 */
00310 
00311 /* ////////////////////////////////////////////////////////////////////// */
00312 
00313 #endif /* !XCONTRACT_INCL_XCONTRACT_H_IMPLICIT_LINK */
00314 
00315 /* ///////////////////////////// end of file //////////////////////////// */

b64 Library documentation © Synesis Software Pty Ltd, 2004-2012