/home/ntakagi/work/STLport-5.1.5/src/dll_main.cpp

Go to the documentation of this file.
00001  /*
00002  *
00003  * Copyright (c) 1994
00004  * Hewlett-Packard Company
00005  *
00006  * Copyright (c) 1996,1997
00007  * Silicon Graphics Computer Systems, Inc.
00008  *
00009  * Copyright (c) 1997
00010  * Moscow Center for SPARC Technology
00011  *
00012  * Copyright (c) 1999
00013  * Boris Fomitchev
00014  *
00015  * This material is provided "as is", with absolutely no warranty expressed
00016  * or implied. Any use is at your own risk.
00017  *
00018  * Permission to use or copy this software for any purpose is hereby granted
00019  * without fee, provided the above notices are retained on all copies.
00020  * Permission to modify the code and to distribute modified code is granted,
00021  * provided the above notices are retained, and a notice that the code was
00022  * modified is included with the above copyright notice.
00023  *
00024  */
00025 
00026 #define __PUT_STATIC_DATA_MEMBERS_HERE
00027 #define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
00028 
00029 #include "stlport_prefix.h"
00030 
00031 #if !defined (_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS)
00032 #  if !defined (__APPLE__) || !defined (__GNUC__) || (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
00033 /* dums: Please if the following code was being uncommented please explain why
00034  * as for the moment it only looks like a source of inconsistency in the way
00035  * STLport different translation units are compiled.
00036  */
00037 //#    define _STLP_ASSERTIONS 1
00038 #  endif
00039 #endif
00040 
00041 #include <utility>
00042 #include <memory>
00043 #include <vector>
00044 #include <set>
00045 #include <list>
00046 #include <slist>
00047 #include <deque>
00048 #include <hash_map>
00049 #include <limits>
00050 #include <string>
00051 #include <stdexcept>
00052 #include <bitset>
00053 #include <locale>
00054 
00055 #if (_STLP_STATIC_TEMPLATE_DATA < 1) || defined (__DMC__)
00056 // for rope static members
00057 #  include <rope>
00058 #endif
00059 
00060 // boris : this piece of code duplicated from _range_errors.h
00061 #undef _STLP_THROW_MSG
00062 #if defined(_STLP_THROW_RANGE_ERRORS)
00063 #  ifndef _STLP_STDEXCEPT
00064 #    include <stdexcept>
00065 #  endif
00066 #  ifndef _STLP_STRING
00067 #    include <string>
00068 #  endif
00069 #  define _STLP_THROW_MSG(ex,msg)  throw ex(string(msg))
00070 #else
00071 #  if defined (_STLP_RTTI_BUG)
00072 #    define _STLP_THROW_MSG(ex,msg)  TerminateProcess(GetCurrentProcess(), 0)
00073 #  else
00074 #    include <cstdlib>
00075 #    include <cstdio>
00076 #    define _STLP_THROW_MSG(ex,msg)  puts(msg),_STLP_ABORT()
00077 #  endif
00078 #endif
00079 
00080 #if defined (_STLP_MSVC) && (_STLP_MSVC < 1310)
00081 #  pragma optimize("g", off)
00082 #endif
00083 
00084 _STLP_BEGIN_NAMESPACE
00085 
00086 void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
00087 { _STLP_THROW_MSG(runtime_error, __msg); }
00088 
00089 void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
00090 { _STLP_THROW_MSG(range_error, __msg); }
00091 
00092 void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
00093 { _STLP_THROW_MSG(out_of_range, __msg); }
00094 
00095 void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
00096 { _STLP_THROW_MSG(length_error, __msg); }
00097 
00098 void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
00099 { _STLP_THROW_MSG(invalid_argument, __msg); }
00100 
00101 void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
00102 { _STLP_THROW_MSG(overflow_error, __msg); }
00103 
00104 #if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
00105 exception::exception() _STLP_NOTHROW {}
00106 exception::~exception() _STLP_NOTHROW {}
00107 bad_exception::bad_exception() _STLP_NOTHROW {}
00108 bad_exception::~bad_exception() _STLP_NOTHROW {}
00109 const char* exception::what() const _STLP_NOTHROW { return "class exception"; }
00110 const char* bad_exception::what() const _STLP_NOTHROW { return "class bad_exception"; }
00111 #endif
00112 
00113 #if defined (_STLP_OWN_STDEXCEPT)
00114 __Named_exception::__Named_exception(const string& __str) {
00115 #if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
00116   strncpy(_M_name, __str.c_str(), _S_bufsize);
00117   _M_name[_S_bufsize - 1] = '\0';
00118 #else
00119   strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), __str.c_str(), _TRUNCATE);
00120 #endif
00121 }
00122 
00123 const char* __Named_exception::what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
00124 
00125 // boris : those are needed to force typeinfo nodes to be created in here only
00126 __Named_exception::~__Named_exception() _STLP_NOTHROW_INHERENTLY {}
00127 
00128 logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {}
00129 runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {}
00130 domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {}
00131 invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {}
00132 length_error::~length_error() _STLP_NOTHROW_INHERENTLY {}
00133 out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {}
00134 range_error::~range_error() _STLP_NOTHROW_INHERENTLY {}
00135 overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {}
00136 underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {}
00137 
00138 #endif /* _STLP_OWN_STDEXCEPT */
00139 
00140 #if !defined(_STLP_WCE_EVC3)
00141 #  if defined (_STLP_NO_BAD_ALLOC)
00142 const nothrow_t nothrow /* = {} */;
00143 #  endif
00144 #endif
00145 
00146 #if !defined (_STLP_NO_FORCE_INSTANTIATE)
00147 
00148 #  if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS)
00149 _STLP_MOVE_TO_PRIV_NAMESPACE
00150 template struct _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
00151 _STLP_MOVE_TO_STD_NAMESPACE
00152 #  endif
00153 
00154 template class _STLP_CLASS_DECLSPEC __debug_alloc<__node_alloc>;
00155 template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>;
00156 
00157 //Export of the types used to represent buckets in the hashtable implementation.
00158 /*
00159  * For the vector class we do not use any MSVC6 workaround even if we export it from
00160  * the STLport dynamic libraries because we know what methods are called and none is
00161  * a template method. Moreover the exported class is an instanciation of vector with
00162  * _Slist_node_base struct that is an internal STLport class that no user should ever
00163  * use.
00164  */
00165 #  if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
00166 template class _STLP_CLASS_DECLSPEC allocator<_STLP_PRIV _Slist_node_base*>;
00167 
00168 _STLP_MOVE_TO_PRIV_NAMESPACE
00169 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
00170                                                       allocator<_Slist_node_base*> >;
00171 template class _STLP_CLASS_DECLSPEC _Vector_base<_Slist_node_base*,
00172                                                  allocator<_Slist_node_base*> >;
00173 _STLP_MOVE_TO_STD_NAMESPACE
00174 #  endif
00175 
00176 #  if defined (_STLP_DEBUG)
00177 _STLP_MOVE_TO_PRIV_NAMESPACE
00178 template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_NAME(vector)<_Slist_node_base*,
00179                                                                allocator<_Slist_node_base*> >;
00180 _STLP_MOVE_TO_STD_NAMESPACE
00181 #  endif
00182 
00183 template class _STLP_CLASS_DECLSPEC vector<_STLP_PRIV _Slist_node_base*,
00184                                            allocator<_STLP_PRIV _Slist_node_base*> >;
00185 //End of hashtable bucket types export.
00186 
00187 //Export of _Locale_impl facets container:
00188 #  if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
00189 template class _STLP_CLASS_DECLSPEC allocator<locale::facet*>;
00190 
00191 _STLP_MOVE_TO_PRIV_NAMESPACE
00192 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
00193 template class _STLP_CLASS_DECLSPEC _Vector_base<locale::facet*, allocator<locale::facet*> >;
00194 _STLP_MOVE_TO_STD_NAMESPACE
00195 
00196 #  endif
00197 #  if defined (_STLP_DEBUG)
00198 _STLP_MOVE_TO_PRIV_NAMESPACE
00199 #    define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
00200 template class _STLP_CLASS_DECLSPEC __construct_checker<_STLP_PRIV _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
00201 template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
00202 #    undef _STLP_NON_DBG_VECTOR
00203 _STLP_MOVE_TO_STD_NAMESPACE
00204 #  endif
00205 
00206 template class _STLP_CLASS_DECLSPEC vector<locale::facet*, allocator<locale::facet*> >;
00207 //End of export of _Locale_impl facets container.
00208 
00209 #  if defined (_STLP_USE_PTR_SPECIALIZATIONS)
00210 template class _STLP_CLASS_DECLSPEC allocator<void*>;
00211 
00212 typedef _STLP_PRIV _List_node<void*> _VoidPtr_Node;
00213 template class _STLP_CLASS_DECLSPEC allocator<_VoidPtr_Node>;
00214 
00215 _STLP_MOVE_TO_PRIV_NAMESPACE
00216 
00217 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void**, void*, allocator<void*> >;
00218 template class _STLP_CLASS_DECLSPEC _Vector_base<void*, allocator<void*> >;
00219 template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(vector)<void*, allocator<void*> >;
00220 
00221 template class _STLP_CLASS_DECLSPEC _List_node<void*>;
00222 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_List_node_base, _VoidPtr_Node, allocator<_VoidPtr_Node> >;
00223 template class _STLP_CLASS_DECLSPEC _List_base<void*, allocator<void*> >;
00224 template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(list)<void*, allocator<void*> >;
00225 
00226 template class _STLP_CLASS_DECLSPEC _Slist_node<void*>;
00227 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base, _Slist_node<void*>, allocator<_Slist_node<void*> > >;
00228 template class _STLP_CLASS_DECLSPEC _Slist_base<void*, allocator<void*> >;
00229 template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(slist)<void*, allocator<void*> >;
00230 
00231 template class  _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
00232 template class  _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void***, void**, allocator<void**> >;
00233 template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
00234 template class  _STLP_CLASS_DECLSPEC _Deque_base<void*, allocator<void*> >;
00235 template class  _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(deque)<void*, allocator<void*> >;
00236 
00237 _STLP_MOVE_TO_STD_NAMESPACE
00238 
00239 #  endif /* _STLP_USE_PTR_SPECIALIZATIONS */
00240 
00241 _STLP_MOVE_TO_PRIV_NAMESPACE
00242 
00243 template class _STLP_CLASS_DECLSPEC _Rb_global<bool>;
00244 template class _STLP_CLASS_DECLSPEC _List_global<bool>;
00245 
00246 template class _STLP_CLASS_DECLSPEC _Sl_global<bool>;
00247 template class _STLP_CLASS_DECLSPEC _Stl_prime<bool>;
00248 
00249 template class _STLP_CLASS_DECLSPEC _LimG<bool>;
00250 
00251 _STLP_MOVE_TO_STD_NAMESPACE
00252 
00253 #endif /* _STLP_NO_FORCE_INSTANTIATE */
00254 
00255 _STLP_END_NAMESPACE
00256 
00257 #define FORCE_SYMBOL extern
00258 
00259 #if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_USE_STATIC_LIB)
00260 // stlportmt.cpp : Defines the entry point for the DLL application.
00261 //
00262 #  define WIN32_LEAN_AND_MEAN
00263 #  include <windows.h>
00264 
00265 #  undef FORCE_SYMBOL
00266 #  define FORCE_SYMBOL APIENTRY
00267 
00268 extern "C" {
00269 
00270 BOOL APIENTRY DllMain( HANDLE hModule,
00271                        DWORD  ul_reason_for_call,
00272                        LPVOID) {
00273   switch (ul_reason_for_call) {
00274     case DLL_PROCESS_ATTACH:
00275       DisableThreadLibraryCalls((HINSTANCE)hModule);
00276     case DLL_THREAD_ATTACH:
00277     case DLL_THREAD_DETACH:
00278     case DLL_PROCESS_DETACH:
00279       break;
00280     }
00281   return TRUE;
00282 }
00283 
00284 } /* extern "C" */
00285 
00286 #if !defined (_STLP_MSVC) && !defined (__MINGW32__)
00287 _STLP_BEGIN_NAMESPACE
00288 
00289 static void FORCE_SYMBOL
00290 force_link() {
00291   set<int>::iterator iter;
00292   // _M_increment; _M_decrement instantiation
00293   ++iter;
00294   --iter;
00295 }
00296 
00297 _STLP_END_NAMESPACE
00298 #endif
00299 
00300 #endif /* _WIN32 */
00301 
00302 #if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
00303 #  undef std
00304 
00305 namespace std
00306 {
00307   void _STLP_CALL unexpected() {
00308     unexpected_handler hdl;
00309     set_unexpected(hdl = set_unexpected((unexpected_handler)0));
00310     hdl();
00311   }
00312 }
00313 #endif



Generated on Mon Mar 10 15:32:16 2008 by  doxygen 1.5.1