diff -r 000000000000 -r e4d67989cc36 stdcpp/src/dll_main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stdcpp/src/dll_main.cpp Tue Feb 02 02:01:42 2010 +0200 @@ -0,0 +1,286 @@ + /* + * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +# define __PUT_STATIC_DATA_MEMBERS_HERE +# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION + +# include "stlport_prefix.h" + +# if !defined(_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS) +# define _STLP_ASSERTIONS 1 +# endif + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +# if ( _STLP_STATIC_TEMPLATE_DATA < 1 ) +// for rope, locale static members +# include +# include +# endif + +# if defined (_STLP_UNIX) +# define _STLP_HAS_PERTHREAD_ALLOCATOR +# include +# endif + +// boris : this piece of code duplicated from _range_errors.h +#undef _STLP_THROW_MSG +#if defined(_STLP_THROW_RANGE_ERRORS) +# ifndef _STLP_STDEXCEPT +# include +# endif +# ifndef _STLP_STRING +# include +# endif +# define _STLP_THROW_MSG(ex,msg) throw ex(string(msg)) +#else +# if defined (_STLP_WINCE) +# define _STLP_THROW_MSG(ex,msg) TerminateProcess(GetCurrentProcess(), 0) +# else +# include +# include +# define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT() +# endif +#endif + +#ifdef _STLP_MSVC +#pragma optimize("g",off) +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_EXP_DECLSPEC void _STLP_CALL __stl_throw_range_error(const char* __msg) { + _STLP_THROW_MSG(range_error, __msg); +} + +_STLP_EXP_DECLSPEC void _STLP_CALL __stl_throw_out_of_range(const char* __msg) { + _STLP_THROW_MSG(out_of_range, __msg); +} + +_STLP_EXP_DECLSPEC void _STLP_CALL __stl_throw_length_error(const char* __msg) { + _STLP_THROW_MSG(length_error, __msg); +} + +_STLP_EXP_DECLSPEC void _STLP_CALL __stl_throw_invalid_argument(const char* __msg) { + _STLP_THROW_MSG(invalid_argument, __msg); +} + +_STLP_EXP_DECLSPEC void _STLP_CALL __stl_throw_overflow_error(const char* __msg) { + _STLP_THROW_MSG(overflow_error, __msg); +} + +_STLP_EXP_DECLSPEC const char* _STLP_CALL +__get_c_string(const string& __str) { + return __str.c_str(); +} + + +# if defined (_STLP_NO_EXCEPTION_HEADER) || defined(_STLP_BROKEN_EXCEPTION_CLASS) +_STLP_EXP_DECLSPEC exception::exception() _STLP_NOTHROW {} +_STLP_EXP_DECLSPEC exception::~exception() _STLP_NOTHROW {} +_STLP_EXP_DECLSPEC bad_exception::bad_exception() _STLP_NOTHROW {} +_STLP_EXP_DECLSPEC bad_exception::~bad_exception() _STLP_NOTHROW {} +_STLP_EXP_DECLSPEC const char* exception::what() const _STLP_NOTHROW {return "class exception";} +_STLP_EXP_DECLSPEC const char* bad_exception::what() const _STLP_NOTHROW {return "class bad_exception";} +# endif + +# ifdef _STLP_OWN_STDEXCEPT +_STLP_EXP_DECLSPEC __Named_exception::__Named_exception(const string& __str) { + strncpy(_M_name, __get_c_string(__str), _S_bufsize); + _M_name[_S_bufsize - 1] = '\0'; +} + +_STLP_EXP_DECLSPEC const char* __Named_exception::what() const _STLP_NOTHROW_INHERENTLY { return _M_name; } + +// boris : those are needed to force typeinfo nodes to be created in here only +_STLP_EXP_DECLSPEC __Named_exception::~__Named_exception() _STLP_NOTHROW_INHERENTLY {} + +_STLP_EXP_DECLSPEC logic_error::logic_error(const string& __s) : __Named_exception(__s) {} +_STLP_EXP_DECLSPEC logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {} + +_STLP_EXP_DECLSPEC runtime_error::runtime_error(const string& __s) : __Named_exception(__s) {} +_STLP_EXP_DECLSPEC runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {} + +_STLP_EXP_DECLSPEC domain_error::domain_error(const string& __arg) : logic_error(__arg) {} +_STLP_EXP_DECLSPEC domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {} + +_STLP_EXP_DECLSPEC invalid_argument::invalid_argument(const string& __arg) + : logic_error(__arg) {} +_STLP_EXP_DECLSPEC invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {} + +_STLP_EXP_DECLSPEC length_error::length_error(const string& __arg) : logic_error(__arg) {} +_STLP_EXP_DECLSPEC length_error::~length_error() _STLP_NOTHROW_INHERENTLY {} + +_STLP_EXP_DECLSPEC out_of_range::out_of_range(const string& __arg) : logic_error(__arg) {} +_STLP_EXP_DECLSPEC out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {} + +_STLP_EXP_DECLSPEC range_error::range_error(const string& __arg) : runtime_error(__arg) {} +_STLP_EXP_DECLSPEC range_error::~range_error() _STLP_NOTHROW_INHERENTLY {} + +_STLP_EXP_DECLSPEC overflow_error::overflow_error(const string& __arg) : runtime_error(__arg) {} +_STLP_EXP_DECLSPEC overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {} + +_STLP_EXP_DECLSPEC underflow_error::underflow_error(const string& __arg) : runtime_error(__arg) {} +_STLP_EXP_DECLSPEC underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {} + +# endif + +# ifdef _STLP_NO_BAD_ALLOC +#ifdef __WINSCW__ +const nothrow_t nothrowObj /* = {} */; +_STLP_EXP_DECLSPEC const nothrow_t& GetNoThrowObj() + { + return nothrowObj; + } + +#endif +# endif + +# ifndef _STLP_NO_FORCE_INSTANTIATE + +# if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS) +template struct _STLP_CLASS_DECLSPEC __stl_debug_engine; +# endif + +#ifndef __SYMBIAN32__ +template class _STLP_CLASS_DECLSPEC __node_alloc; +template class _STLP_CLASS_DECLSPEC __node_alloc; +template class _STLP_CLASS_DECLSPEC __debug_alloc< __node_alloc >; +template class _STLP_CLASS_DECLSPEC __debug_alloc< __node_alloc >; +template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>; +template class _STLP_CLASS_DECLSPEC __malloc_alloc<0>; +#endif + +# if defined (_STLP_THREADS) && ! defined ( _STLP_ATOMIC_EXCHANGE ) && (defined(_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS)) +template class _STLP_CLASS_DECLSPEC _Swap_lock_struct<0>; +# endif + +template class allocator; +template class _STLP_alloc_proxy >; +template class _Vector_base >; +# if defined (_STLP_DEBUG) && ! defined (__SUNPRO_CC) +template class __WORKAROUND_DBG_RENAME(vector) >; +# endif +template class __vector__ >; + +template class _Rb_global; +template class _List_global; +template class _Sl_global; +template class _Stl_prime; +template class _LimG; +template class _Bs_G; + +template class _STLP_CLASS_DECLSPEC allocator; +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy >; +template class _STLP_CLASS_DECLSPEC _String_base >; + +# if defined (_STLP_DEBUG) && ! defined (__SUNPRO_CC) +template class _STLP_CLASS_DECLSPEC _Nondebug_string, allocator >; +# endif + +template class basic_string, allocator >; +# endif + +_STLP_END_NAMESPACE + +#define FORCE_SYMBOL extern + +# if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && ! defined (_STLP_USE_STATIC_LIB) && ! defined (_STLP_USE_STATICX_LIB) && !defined (__SYMBIAN32__) +// stlportmt.cpp : Defines the entry point for the DLL application. +// +#define WIN32_LEAN_AND_MEAN +#include + +#undef FORCE_SYMBOL +#define FORCE_SYMBOL APIENTRY + +extern "C" { + +BOOL APIENTRY DllMain( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls((HINSTANCE)hModule); + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +} /* extern "C" */ + +_STLP_BEGIN_NAMESPACE + +void FORCE_SYMBOL +force_link() +{ + float f; + f = numeric_limits::infinity(); + f = numeric_limits::quiet_NaN(); + f = numeric_limits::signaling_NaN(); + double d; + d = numeric_limits::infinity(); + d = numeric_limits::quiet_NaN(); + d = numeric_limits::signaling_NaN(); +#ifndef _STLP_NO_LONG_DOUBLE + long double ld; + ld = numeric_limits::infinity(); + ld = numeric_limits::quiet_NaN(); + ld = numeric_limits::signaling_NaN(); +#endif + + set::iterator iter; + // _M_increment; _M_decrement instantiation + ++iter; + --iter; + + // force bitset globals to be instantiated + unsigned char uc = _Bs_G::_S_bit_count[0]; + uc += _Bs_G::_S_first_one[0]; +} + +_STLP_END_NAMESPACE + + +# endif