os/ossrv/genericopenlibs/cppstdlib/stl/src/dll_main.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
 /*
sl@0
     2
 *
sl@0
     3
 * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
sl@0
     4
 *
sl@0
     5
 * Copyright (c) 1994
sl@0
     6
 * Hewlett-Packard Company
sl@0
     7
 *
sl@0
     8
 * Copyright (c) 1996,1997
sl@0
     9
 * Silicon Graphics Computer Systems, Inc.
sl@0
    10
 *
sl@0
    11
 * Copyright (c) 1997
sl@0
    12
 * Moscow Center for SPARC Technology
sl@0
    13
 *
sl@0
    14
 * Copyright (c) 1999
sl@0
    15
 * Boris Fomitchev
sl@0
    16
 *
sl@0
    17
 * This material is provided "as is", with absolutely no warranty expressed
sl@0
    18
 * or implied. Any use is at your own risk.
sl@0
    19
 *
sl@0
    20
 * Permission to use or copy this software for any purpose is hereby granted
sl@0
    21
 * without fee, provided the above notices are retained on all copies.
sl@0
    22
 * Permission to modify the code and to distribute modified code is granted,
sl@0
    23
 * provided the above notices are retained, and a notice that the code was
sl@0
    24
 * modified is included with the above copyright notice.
sl@0
    25
 *
sl@0
    26
 */
sl@0
    27
sl@0
    28
#define __PUT_STATIC_DATA_MEMBERS_HERE
sl@0
    29
#define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION
sl@0
    30
sl@0
    31
#include "stlport_prefix.h"
sl@0
    32
sl@0
    33
#if !defined (_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS)
sl@0
    34
#  if !defined (__APPLE__) || !defined (__GNUC__) || (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
sl@0
    35
/* dums: Please if the following code was being uncommented please explain why
sl@0
    36
 * as for the moment it only looks like a source of inconsistency in the way
sl@0
    37
 * STLport different translation units are compiled.
sl@0
    38
 */
sl@0
    39
//#    define _STLP_ASSERTIONS 1
sl@0
    40
#  endif
sl@0
    41
#endif
sl@0
    42
sl@0
    43
#include <utility>
sl@0
    44
#include <memory>
sl@0
    45
#include <vector>
sl@0
    46
#include <set>
sl@0
    47
#include <list>
sl@0
    48
#include <slist>
sl@0
    49
#include <deque>
sl@0
    50
#include <hash_map>
sl@0
    51
#include <limits>
sl@0
    52
#include <string>
sl@0
    53
#include <stdexcept>
sl@0
    54
#include <bitset>
sl@0
    55
#include <locale>
sl@0
    56
sl@0
    57
#if (_STLP_STATIC_TEMPLATE_DATA < 1) || defined (__DMC__)
sl@0
    58
// for rope static members
sl@0
    59
#  include <rope>
sl@0
    60
#endif
sl@0
    61
sl@0
    62
// boris : this piece of code duplicated from _range_errors.h
sl@0
    63
#undef _STLP_THROW_MSG
sl@0
    64
#if defined(_STLP_THROW_RANGE_ERRORS)
sl@0
    65
#  ifndef _STLP_STDEXCEPT
sl@0
    66
#    include <stdexcept>
sl@0
    67
#  endif
sl@0
    68
#  ifndef _STLP_STRING
sl@0
    69
#    include <string>
sl@0
    70
#  endif
sl@0
    71
#  define _STLP_THROW_MSG(ex,msg)  throw ex(string(msg))
sl@0
    72
#else
sl@0
    73
#  if defined (_STLP_RTTI_BUG)
sl@0
    74
#    define _STLP_THROW_MSG(ex,msg)  TerminateProcess(GetCurrentProcess(), 0)
sl@0
    75
#  else
sl@0
    76
#    include <cstdlib>
sl@0
    77
#    include <cstdio>
sl@0
    78
#    define _STLP_THROW_MSG(ex,msg)  puts(msg),_STLP_ABORT()
sl@0
    79
#  endif
sl@0
    80
#endif
sl@0
    81
sl@0
    82
#if defined (_STLP_MSVC) && (_STLP_MSVC < 1310)
sl@0
    83
#  pragma optimize("g", off)
sl@0
    84
#endif
sl@0
    85
sl@0
    86
_STLP_BEGIN_NAMESPACE
sl@0
    87
sl@0
    88
void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg)
sl@0
    89
{ _STLP_THROW_MSG(runtime_error, __msg); }
sl@0
    90
sl@0
    91
void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg)
sl@0
    92
{ _STLP_THROW_MSG(range_error, __msg); }
sl@0
    93
sl@0
    94
void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg)
sl@0
    95
{ _STLP_THROW_MSG(out_of_range, __msg); }
sl@0
    96
sl@0
    97
void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg)
sl@0
    98
{ _STLP_THROW_MSG(length_error, __msg); }
sl@0
    99
sl@0
   100
void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg)
sl@0
   101
{ _STLP_THROW_MSG(invalid_argument, __msg); }
sl@0
   102
sl@0
   103
void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg)
sl@0
   104
{ _STLP_THROW_MSG(overflow_error, __msg); }
sl@0
   105
sl@0
   106
#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
sl@0
   107
exception::exception() _STLP_NOTHROW {}
sl@0
   108
exception::~exception() _STLP_NOTHROW {}
sl@0
   109
bad_exception::bad_exception() _STLP_NOTHROW {}
sl@0
   110
bad_exception::~bad_exception() _STLP_NOTHROW {}
sl@0
   111
const char* exception::what() const _STLP_NOTHROW { return "class exception"; }
sl@0
   112
const char* bad_exception::what() const _STLP_NOTHROW { return "class bad_exception"; }
sl@0
   113
#endif
sl@0
   114
sl@0
   115
#if defined (_STLP_OWN_STDEXCEPT)
sl@0
   116
_STLP_DECLSPEC __Named_exception::__Named_exception(const string& __str) {
sl@0
   117
#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
sl@0
   118
  strncpy(_M_name, __str.c_str(), _S_bufsize);
sl@0
   119
  _M_name[_S_bufsize - 1] = '\0';
sl@0
   120
#else
sl@0
   121
  strncpy_s(_STLP_ARRAY_AND_SIZE(_M_name), __str.c_str(), _TRUNCATE);
sl@0
   122
#endif
sl@0
   123
}
sl@0
   124
sl@0
   125
_STLP_DECLSPEC const char* __Named_exception::what() const _STLP_NOTHROW_INHERENTLY { return _M_name; }
sl@0
   126
sl@0
   127
// boris : those are needed to force typeinfo nodes to be created in here only
sl@0
   128
_STLP_DECLSPEC __Named_exception::~__Named_exception() _STLP_NOTHROW_INHERENTLY {}
sl@0
   129
sl@0
   130
_STLP_DECLSPEC logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {}
sl@0
   131
_STLP_DECLSPEC runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {}
sl@0
   132
_STLP_DECLSPEC domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {}
sl@0
   133
_STLP_DECLSPEC invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {}
sl@0
   134
_STLP_DECLSPEC length_error::~length_error() _STLP_NOTHROW_INHERENTLY {}
sl@0
   135
_STLP_DECLSPEC out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {}
sl@0
   136
_STLP_DECLSPEC range_error::~range_error() _STLP_NOTHROW_INHERENTLY {}
sl@0
   137
_STLP_DECLSPEC overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {}
sl@0
   138
_STLP_DECLSPEC underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {}
sl@0
   139
sl@0
   140
#endif /* _STLP_OWN_STDEXCEPT */
sl@0
   141
sl@0
   142
#if !defined(_STLP_WCE_EVC3)
sl@0
   143
#  if defined (_STLP_NO_BAD_ALLOC)
sl@0
   144
const nothrow_t nothrow /* = {} */;
sl@0
   145
#  endif
sl@0
   146
#endif
sl@0
   147
sl@0
   148
#if !defined (_STLP_NO_FORCE_INSTANTIATE)
sl@0
   149
sl@0
   150
#  if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS)
sl@0
   151
_STLP_MOVE_TO_PRIV_NAMESPACE
sl@0
   152
template struct _STLP_CLASS_DECLSPEC __stl_debug_engine<bool>;
sl@0
   153
_STLP_MOVE_TO_STD_NAMESPACE
sl@0
   154
#  endif
sl@0
   155
sl@0
   156
template class _STLP_CLASS_DECLSPEC __debug_alloc<__node_alloc>;
sl@0
   157
template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>;
sl@0
   158
sl@0
   159
//Export of the types used to represent buckets in the hashtable implementation.
sl@0
   160
/*
sl@0
   161
 * For the vector class we do not use any MSVC6 workaround even if we export it from
sl@0
   162
 * the STLport dynamic libraries because we know what methods are called and none is
sl@0
   163
 * a template method. Moreover the exported class is an instanciation of vector with
sl@0
   164
 * _Slist_node_base struct that is an internal STLport class that no user should ever
sl@0
   165
 * use.
sl@0
   166
 */
sl@0
   167
#  if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
sl@0
   168
template class _STLP_CLASS_DECLSPEC allocator<_STLP_PRIV _Slist_node_base*>;
sl@0
   169
sl@0
   170
_STLP_MOVE_TO_PRIV_NAMESPACE
sl@0
   171
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*,
sl@0
   172
                                                      allocator<_Slist_node_base*> >;
sl@0
   173
template class _STLP_CLASS_DECLSPEC _Vector_base<_Slist_node_base*,
sl@0
   174
                                                 allocator<_Slist_node_base*> >;
sl@0
   175
_STLP_MOVE_TO_STD_NAMESPACE
sl@0
   176
#  endif
sl@0
   177
sl@0
   178
#  if defined (_STLP_DEBUG)
sl@0
   179
_STLP_MOVE_TO_PRIV_NAMESPACE
sl@0
   180
template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_NAME(vector)<_Slist_node_base*,
sl@0
   181
                                                               allocator<_Slist_node_base*> >;
sl@0
   182
_STLP_MOVE_TO_STD_NAMESPACE
sl@0
   183
#  endif
sl@0
   184
sl@0
   185
template class _STLP_CLASS_DECLSPEC vector<_STLP_PRIV _Slist_node_base*,
sl@0
   186
                                           allocator<_STLP_PRIV _Slist_node_base*> >;
sl@0
   187
//End of hashtable bucket types export.
sl@0
   188
sl@0
   189
//Export of _Locale_impl facets container:
sl@0
   190
#  if !defined (_STLP_USE_PTR_SPECIALIZATIONS)
sl@0
   191
template class _STLP_CLASS_DECLSPEC allocator<locale::facet*>;
sl@0
   192
sl@0
   193
_STLP_MOVE_TO_PRIV_NAMESPACE
sl@0
   194
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<locale::facet**, locale::facet*, allocator<locale::facet*> >;
sl@0
   195
template class _STLP_CLASS_DECLSPEC _Vector_base<locale::facet*, allocator<locale::facet*> >;
sl@0
   196
_STLP_MOVE_TO_STD_NAMESPACE
sl@0
   197
sl@0
   198
#  endif
sl@0
   199
#  if defined (_STLP_DEBUG)
sl@0
   200
_STLP_MOVE_TO_PRIV_NAMESPACE
sl@0
   201
#    define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector)
sl@0
   202
template class _STLP_CLASS_DECLSPEC __construct_checker<_STLP_PRIV _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> > >;
sl@0
   203
template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_VECTOR<locale::facet*, allocator<locale::facet*> >;
sl@0
   204
#    undef _STLP_NON_DBG_VECTOR
sl@0
   205
_STLP_MOVE_TO_STD_NAMESPACE
sl@0
   206
#  endif
sl@0
   207
sl@0
   208
template class _STLP_CLASS_DECLSPEC vector<locale::facet*, allocator<locale::facet*> >;
sl@0
   209
//End of export of _Locale_impl facets container.
sl@0
   210
sl@0
   211
#  if defined (_STLP_USE_PTR_SPECIALIZATIONS)
sl@0
   212
template class _STLP_CLASS_DECLSPEC allocator<void*>;
sl@0
   213
sl@0
   214
typedef _STLP_PRIV _List_node<void*> _VoidPtr_Node;
sl@0
   215
template class _STLP_CLASS_DECLSPEC allocator<_VoidPtr_Node>;
sl@0
   216
sl@0
   217
_STLP_MOVE_TO_PRIV_NAMESPACE
sl@0
   218
sl@0
   219
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void**, void*, allocator<void*> >;
sl@0
   220
template class _STLP_CLASS_DECLSPEC _Vector_base<void*, allocator<void*> >;
sl@0
   221
template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(vector)<void*, allocator<void*> >;
sl@0
   222
sl@0
   223
template class _STLP_CLASS_DECLSPEC _List_node<void*>;
sl@0
   224
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_List_node_base, _VoidPtr_Node, allocator<_VoidPtr_Node> >;
sl@0
   225
template class _STLP_CLASS_DECLSPEC _List_base<void*, allocator<void*> >;
sl@0
   226
template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(list)<void*, allocator<void*> >;
sl@0
   227
sl@0
   228
template class _STLP_CLASS_DECLSPEC _Slist_node<void*>;
sl@0
   229
template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base, _Slist_node<void*>, allocator<_Slist_node<void*> > >;
sl@0
   230
template class _STLP_CLASS_DECLSPEC _Slist_base<void*, allocator<void*> >;
sl@0
   231
template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(slist)<void*, allocator<void*> >;
sl@0
   232
sl@0
   233
template class  _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<size_t, void*, allocator<void*> >;
sl@0
   234
template class  _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<void***, void**, allocator<void**> >;
sl@0
   235
template struct _STLP_CLASS_DECLSPEC _Deque_iterator<void*, _Nonconst_traits<void*> >;
sl@0
   236
template class  _STLP_CLASS_DECLSPEC _Deque_base<void*, allocator<void*> >;
sl@0
   237
template class  _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(deque)<void*, allocator<void*> >;
sl@0
   238
sl@0
   239
_STLP_MOVE_TO_STD_NAMESPACE
sl@0
   240
sl@0
   241
#  endif /* _STLP_USE_PTR_SPECIALIZATIONS */
sl@0
   242
sl@0
   243
_STLP_MOVE_TO_PRIV_NAMESPACE
sl@0
   244
sl@0
   245
template class _STLP_CLASS_DECLSPEC _Rb_global<bool>;
sl@0
   246
template class _STLP_CLASS_DECLSPEC _List_global<bool>;
sl@0
   247
sl@0
   248
template class _STLP_CLASS_DECLSPEC _Sl_global<bool>;
sl@0
   249
template class _STLP_CLASS_DECLSPEC _Stl_prime<bool>;
sl@0
   250
sl@0
   251
template class _STLP_CLASS_DECLSPEC _LimG<bool>;
sl@0
   252
sl@0
   253
_STLP_MOVE_TO_STD_NAMESPACE
sl@0
   254
sl@0
   255
#endif /* _STLP_NO_FORCE_INSTANTIATE */
sl@0
   256
sl@0
   257
_STLP_END_NAMESPACE
sl@0
   258
sl@0
   259
#define FORCE_SYMBOL extern
sl@0
   260
sl@0
   261
#if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_USE_STATIC_LIB) && !defined __SYMBIAN32__
sl@0
   262
// stlportmt.cpp : Defines the entry point for the DLL application.
sl@0
   263
//
sl@0
   264
#  define WIN32_LEAN_AND_MEAN
sl@0
   265
#  include <windows.h>
sl@0
   266
sl@0
   267
#  undef FORCE_SYMBOL
sl@0
   268
#  define FORCE_SYMBOL APIENTRY
sl@0
   269
sl@0
   270
extern "C" {
sl@0
   271
sl@0
   272
BOOL APIENTRY DllMain( HANDLE hModule,
sl@0
   273
                       DWORD  ul_reason_for_call,
sl@0
   274
                       LPVOID) {
sl@0
   275
  switch (ul_reason_for_call) {
sl@0
   276
    case DLL_PROCESS_ATTACH:
sl@0
   277
      DisableThreadLibraryCalls((HINSTANCE)hModule);
sl@0
   278
    case DLL_THREAD_ATTACH:
sl@0
   279
    case DLL_THREAD_DETACH:
sl@0
   280
    case DLL_PROCESS_DETACH:
sl@0
   281
      break;
sl@0
   282
    }
sl@0
   283
  return TRUE;
sl@0
   284
}
sl@0
   285
sl@0
   286
} /* extern "C" */
sl@0
   287
sl@0
   288
#if !defined (_STLP_MSVC) && !defined (__MINGW32__)
sl@0
   289
_STLP_BEGIN_NAMESPACE
sl@0
   290
sl@0
   291
static void FORCE_SYMBOL
sl@0
   292
force_link() {
sl@0
   293
  set<int>::iterator iter;
sl@0
   294
  // _M_increment; _M_decrement instantiation
sl@0
   295
  ++iter;
sl@0
   296
  --iter;
sl@0
   297
}
sl@0
   298
sl@0
   299
_STLP_END_NAMESPACE
sl@0
   300
#endif
sl@0
   301
sl@0
   302
#endif /* _WIN32 */
sl@0
   303
sl@0
   304
#if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
sl@0
   305
#  undef std
sl@0
   306
sl@0
   307
namespace std
sl@0
   308
{
sl@0
   309
  void _STLP_CALL unexpected() {
sl@0
   310
    unexpected_handler hdl;
sl@0
   311
    set_unexpected(hdl = set_unexpected((unexpected_handler)0));
sl@0
   312
    hdl();
sl@0
   313
  }
sl@0
   314
}
sl@0
   315
#endif