Synesis Software

cstring/implicit_link.h

Go to the documentation of this file.
00001 /* /////////////////////////////////////////////////////////////////////////////
00002  * File:    cstring/implicit_link.h
00003  *
00004  * Purpose: Implicit linking for the cstring API.
00005  *
00006  * Created: 18th August 2005
00007  * Updated: 26th January 2007
00008  *
00009  * Home:    http://synesis.com.au/software/
00010  *
00011  * Copyright (c) 1994-2007, 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 met:
00016  *
00017  * - Redistributions of source code must retain the above copyright notice, this
00018  *   list of conditions and the following disclaimer. 
00019  * - Redistributions in binary form must reproduce the above copyright notice,
00020  *   this list of conditions and the following disclaimer in the documentation
00021  *   and/or other materials provided with the distribution.
00022  * - Neither the names of Matthew Wilson and Synesis Software nor the names of
00023  *   any contributors may be used to endorse or promote products derived from
00024  *   this software without specific prior written permission.
00025  *
00026  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00027  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00029  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00030  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00031  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00032  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00033  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00034  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00035  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00036  * POSSIBILITY OF SUCH DAMAGE.
00037  *
00038  * ////////////////////////////////////////////////////////////////////////// */
00039 
00040 
00044 #ifndef CSTRING_INCL_IMPLICIT_LINK
00045 #define CSTRING_INCL_IMPLICIT_LINK
00046 
00047 /* /////////////////////////////////////////////////////////////////////////////
00048  * Version
00049  */
00050 
00051 #ifndef CSTRING_DOCUMENTATION_SKIP_SECTION
00052 # define CSTRING_VER_CSTRING_H_IMPLICIT_LINK_MAJOR      1
00053 # define CSTRING_VER_CSTRING_H_IMPLICIT_LINK_MINOR      0
00054 # define CSTRING_VER_CSTRING_H_IMPLICIT_LINK_REVISION   2
00055 # define CSTRING_VER_CSTRING_H_IMPLICIT_LINK_EDIT       4
00056 #endif /* !CSTRING_DOCUMENTATION_SKIP_SECTION */
00057 
00058 /* /////////////////////////////////////////////////////////////////////////////
00059  * Includes
00060  */
00061 
00062 #include <cstring/cstring.h>
00063 
00064 /* /////////////////////////////////////////////////////////////////////////////
00065  * Implicit linking
00066  */
00067 
00068 #if defined(WIN32) || \
00069     defined(_WIN32)
00070 
00071 # if defined(__BORLANDC__) || \
00072      /* defined(__DMC__) || */ \
00073      defined(__INTEL_COMPILER) || \
00074      defined(__MWERKS__) || \
00075      defined(_MSC_VER)
00076 #  define CSTRING_IMPLICIT_LINK_SUPPORT
00077 # endif /* compiler */
00078 
00079 #if defined(CSTRING_IMPLICIT_LINK_SUPPORT) && \
00080     defined(CSTRING_NO_IMPLICIT_LINK)
00081 # undef CSTRING_IMPLICIT_LINK_SUPPORT
00082 #endif /* CSTRING_IMPLICIT_LINK_SUPPORT && CSTRING_NO_IMPLICIT_LINK */
00083 
00084 # if defined(CSTRING_IMPLICIT_LINK_SUPPORT)
00085 
00086 #  if defined(__BORLANDC__)
00087 #   if __BORLANDC__ == 0x0550
00088 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "bc55"
00089 #   elif (__BORLANDC__ == 0x0551)
00090 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "bc551"
00091 #   elif (__BORLANDC__ == 0x0560)
00092 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "bc56"
00093 #   elif (__BORLANDC__ == 0x0564)
00094 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "bc564"
00095 #   else /* ? __BORLANDC__ */
00096 #    error Unrecognised value of __BORLANDC__
00097 #   endif /* __BORLANDC__ */
00098 
00099 /*
00100 #  elif defined(__DMC__)
00101 #   define CSTRING_IMPL_LINK_COMPILER_NAME          "dm"
00102  */
00103 
00104 #  elif defined(__INTEL_COMPILER)
00105 #   if (__INTEL_COMPILER == 600)
00106 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "icl6"
00107 #   elif (__INTEL_COMPILER == 700)
00108 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "icl7"
00109 #   elif (__INTEL_COMPILER == 800)
00110 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "icl8"
00111 #   else /* ? __INTEL_COMPILER */
00112 #    error Unrecognised value of __INTEL_COMPILER
00113 #   endif /* __INTEL_COMPILER */
00114 
00115 #  elif defined(__MWERKS__)
00116 #   if ((__MWERKS__ & 0xFF00) == 0x2400)
00117 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "cw7"
00118 #   elif ((__MWERKS__ & 0xFF00) == 0x3000)
00119 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "cw8"
00120 #   elif ((__MWERKS__ & 0xFF00) == 0x3200)
00121 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "cw9"
00122 #   else /* ? __MWERKS__ */
00123 #    error Unrecognised value of __MWERKS__
00124 #   endif /* __MWERKS__ */
00125 
00126 #  elif defined(_MSC_VER)
00127 #   if _MSC_VER == 1000
00128 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "vc4"
00129 #   elif _MSC_VER == 1020
00130 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "vc42"
00131 #   elif _MSC_VER == 1100
00132 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "vc5"
00133 #   elif _MSC_VER == 1200
00134 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "vc6"
00135 #   elif _MSC_VER == 1300
00136 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "vc7"
00137 #   elif _MSC_VER == 1310
00138 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "vc71"
00139 #   elif _MSC_VER == 1400
00140 #    define CSTRING_IMPL_LINK_COMPILER_NAME         "vc8"
00141 #   else /* ? _MSC_VER */
00142 #    error Unrecognised value of _MSC_VER
00143 #   endif /* _MSC_VER */
00144 
00145 #  else /* ? compiler */
00146 #   error Unrecognised compiler
00147 #  endif /* compiler */
00148 
00149 
00150 # if defined(__MT__) || \
00151      defined(_REENTRANT) || \
00152      defined(_MT)
00153 #  if defined(_DLL) || \
00154       defined(__DLL)
00155 #   define CSTRING_IMPL_LINK_THREADING_TYPE         ".dll"
00156 #  else /* ? dll */
00157 #   define CSTRING_IMPL_LINK_THREADING_TYPE         ".mt"
00158 #  endif /* dll */
00159 # else /* ? mt */
00160 #   define CSTRING_IMPL_LINK_THREADING_TYPE         ""
00161 # endif /* mt */
00162 
00163 
00164 # if !defined(NDEBUG) && \
00165      defined(_DEBUG)
00166 #  define CSTRING_IMPL_LINK_DEBUG_TYPE              ".debug"
00167 # else /* ? debug */
00168 #  define CSTRING_IMPL_LINK_DEBUG_TYPE              ""
00169 # endif /* debug */
00170 
00171 
00172 # define CSTRING_IMPL_LINK_LIBRARY_BASENAME_s_(x)   #x
00173 # define CSTRING_IMPL_LINK_LIBRARY_BASENAME_s(x)    CSTRING_IMPL_LINK_LIBRARY_BASENAME_s_(x)
00174 # define CSTRING_IMPL_LINK_LIBRARY_BASENAME         "cstring." CSTRING_IMPL_LINK_LIBRARY_BASENAME_s(CSTRING_VER_MAJOR) "."
00175 
00176 # define CSTRING_IMPL_LINK_LIBRARY_NAME             CSTRING_IMPL_LINK_LIBRARY_BASENAME CSTRING_IMPL_LINK_COMPILER_NAME CSTRING_IMPL_LINK_THREADING_TYPE CSTRING_IMPL_LINK_DEBUG_TYPE ".lib"
00177 
00178 # pragma message("lib: " CSTRING_IMPL_LINK_LIBRARY_NAME)
00179 
00180 # pragma comment(lib, CSTRING_IMPL_LINK_LIBRARY_NAME)
00181 
00182 # endif /* CSTRING_IMPLICIT_LINK_SUPPORT */
00183 
00184 #endif /* Win32 */
00185 
00186 /* ////////////////////////////////////////////////////////////////////////// */
00187 
00188 #endif /* CSTRING_INCL_IMPLICIT_LINK */
00189 
00190 /* ////////////////////////////////////////////////////////////////////////// */

cstring Library documentation © Matthew Wilson and Synesis Software Pty Ltd, 1994-2007