2 * Copyright 2010 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(msvcp
);
30 #define CLASS_IS_SIMPLE_TYPE 1
31 #define CLASS_HAS_VIRTUAL_BASE_CLASS 4
33 void WINAPI
_CxxThrowException(exception
*,const cxx_exception_type
*);
36 extern const vtable_ptr MSVCP_exception_vtable
;
37 extern const vtable_ptr MSVCP_bad_alloc_vtable
;
38 extern const vtable_ptr MSVCP_logic_error_vtable
;
39 extern const vtable_ptr MSVCP_length_error_vtable
;
40 extern const vtable_ptr MSVCP_out_of_range_vtable
;
41 extern const vtable_ptr MSVCP_invalid_argument_vtable
;
42 extern const vtable_ptr MSVCP_runtime_error_vtable
;
43 extern const vtable_ptr MSVCP_failure_vtable
;
44 extern const vtable_ptr MSVCP_bad_cast_vtable
;
46 static void MSVCP_type_info_dtor(type_info
* _this
)
52 DEFINE_THISCALL_WRAPPER(MSVCP_type_info_vector_dtor
,8)
53 void * __thiscall
MSVCP_type_info_vector_dtor(type_info
* _this
, unsigned int flags
)
55 TRACE("(%p %x)\n", _this
, flags
);
58 /* we have an array, with the number of elements stored before the first object */
59 INT_PTR i
, *ptr
= (INT_PTR
*)_this
- 1;
61 for (i
= *ptr
- 1; i
>= 0; i
--) MSVCP_type_info_dtor(_this
+ i
);
62 MSVCRT_operator_delete(ptr
);
66 MSVCP_type_info_dtor(_this
);
67 if (flags
& 1) MSVCRT_operator_delete(_this
);
72 DEFINE_RTTI_DATA0( type_info
, 0, ".?AVtype_info@@" )
74 static exception
* MSVCP_exception_ctor(exception
*this, const char **name
)
76 TRACE("(%p %s)\n", this, *name
);
78 this->vtable
= &MSVCP_exception_vtable
;
80 unsigned int name_len
= strlen(*name
) + 1;
81 this->name
= malloc(name_len
);
82 memcpy(this->name
, *name
, name_len
);
86 this->do_free
= FALSE
;
91 DEFINE_THISCALL_WRAPPER(MSVCP_exception_copy_ctor
,8)
92 exception
* __thiscall
MSVCP_exception_copy_ctor(exception
*this, const exception
*rhs
)
94 TRACE("(%p,%p)\n", this, rhs
);
97 this->vtable
= &MSVCP_exception_vtable
;
98 this->name
= rhs
->name
;
99 this->do_free
= FALSE
;
101 MSVCP_exception_ctor(this, (const char**)&rhs
->name
);
102 TRACE("name = %s\n", this->name
);
106 DEFINE_THISCALL_WRAPPER(MSVCP_exception_dtor
,4)
107 void __thiscall
MSVCP_exception_dtor(exception
*this)
109 TRACE("(%p)\n", this);
110 this->vtable
= &MSVCP_exception_vtable
;
115 DEFINE_THISCALL_WRAPPER(MSVCP_exception_vector_dtor
, 8)
116 void * __thiscall
MSVCP_exception_vector_dtor(exception
*this, unsigned int flags
)
118 TRACE("%p %x\n", this, flags
);
120 /* we have an array, with the number of elements stored before the first object */
121 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
123 for(i
=*ptr
-1; i
>=0; i
--)
124 MSVCP_exception_dtor(this+i
);
125 MSVCRT_operator_delete(ptr
);
127 MSVCP_exception_dtor(this);
129 MSVCRT_operator_delete(this);
135 DEFINE_RTTI_DATA0(exception
, 0, ".?AVexception@std@@")
136 DEFINE_CXX_DATA0(exception
, MSVCP_exception_dtor
)
138 /* bad_alloc class data */
139 typedef exception bad_alloc
;
141 static bad_alloc
* MSVCP_bad_alloc_ctor(bad_alloc
*this, const char **name
)
143 TRACE("%p %s\n", this, *name
);
144 MSVCP_exception_ctor(this, name
);
145 this->vtable
= &MSVCP_bad_alloc_vtable
;
149 DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_copy_ctor
, 8)
150 bad_alloc
* __thiscall
MSVCP_bad_alloc_copy_ctor(bad_alloc
*this, const bad_alloc
*rhs
)
152 TRACE("%p %p\n", this, rhs
);
153 MSVCP_exception_copy_ctor(this, rhs
);
154 this->vtable
= &MSVCP_bad_alloc_vtable
;
158 DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_dtor
, 4)
159 void __thiscall
MSVCP_bad_alloc_dtor(bad_alloc
*this)
162 MSVCP_exception_dtor(this);
165 DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_vector_dtor
, 8)
166 void * __thiscall
MSVCP_bad_alloc_vector_dtor(bad_alloc
*this, unsigned int flags
)
168 TRACE("%p %x\n", this, flags
);
170 /* we have an array, with the number of elements stored before the first object */
171 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
173 for(i
=*ptr
-1; i
>=0; i
--)
174 MSVCP_bad_alloc_dtor(this+i
);
175 MSVCRT_operator_delete(ptr
);
177 MSVCP_bad_alloc_dtor(this);
179 MSVCRT_operator_delete(this);
185 DEFINE_THISCALL_WRAPPER(MSVCP_what_exception
,4)
186 const char* __thiscall
MSVCP_what_exception(exception
* this)
188 TRACE("(%p) returning %s\n", this, this->name
);
189 return this->name
? this->name
: "Unknown exception";
192 DEFINE_RTTI_DATA1(bad_alloc
, 0, &exception_rtti_base_descriptor
, ".?AVbad_alloc@std@@")
193 DEFINE_CXX_DATA1(bad_alloc
, &exception_cxx_type_info
, MSVCP_bad_alloc_dtor
)
195 /* logic_error class data */
196 typedef struct _logic_error
{
198 basic_string_char str
;
201 static logic_error
* MSVCP_logic_error_ctor(
202 logic_error
*this, const char **name
)
204 TRACE("%p %s\n", this, *name
);
205 this->e
.vtable
= &MSVCP_logic_error_vtable
;
207 this->e
.do_free
= FALSE
;
208 MSVCP_basic_string_char_ctor_cstr(&this->str
, *name
);
212 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_copy_ctor
, 8)
213 logic_error
* __thiscall
MSVCP_logic_error_copy_ctor(
214 logic_error
*this, logic_error
*rhs
)
216 TRACE("%p %p\n", this, rhs
);
217 MSVCP_exception_copy_ctor(&this->e
, &rhs
->e
);
218 MSVCP_basic_string_char_copy_ctor(&this->str
, &rhs
->str
);
219 this->e
.vtable
= &MSVCP_logic_error_vtable
;
223 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_dtor
, 4)
224 void __thiscall
MSVCP_logic_error_dtor(logic_error
*this)
227 MSVCP_exception_dtor(&this->e
);
228 MSVCP_basic_string_char_dtor(&this->str
);
231 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_vector_dtor
, 8)
232 void* __thiscall
MSVCP_logic_error_vector_dtor(
233 logic_error
*this, unsigned int flags
)
235 TRACE("%p %x\n", this, flags
);
237 /* we have an array, with the number of elements stored before the first object */
238 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
240 for(i
=*ptr
-1; i
>=0; i
--)
241 MSVCP_logic_error_dtor(this+i
);
242 MSVCRT_operator_delete(ptr
);
244 MSVCP_logic_error_dtor(this);
246 MSVCRT_operator_delete(this);
252 DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_what
, 4)
253 const char* __thiscall
MSVCP_logic_error_what(logic_error
*this)
256 return MSVCP_basic_string_char_c_str(&this->str
);
259 DEFINE_RTTI_DATA1(logic_error
, 0, &exception_rtti_base_descriptor
, ".?AVlogic_error@std@@")
260 DEFINE_CXX_DATA1(logic_error
, &exception_cxx_type_info
, MSVCP_logic_error_dtor
)
262 /* length_error class data */
263 typedef logic_error length_error
;
265 static length_error
* MSVCP_length_error_ctor(
266 length_error
*this, const char **name
)
268 TRACE("%p %s\n", this, *name
);
269 MSVCP_logic_error_ctor(this, name
);
270 this->e
.vtable
= &MSVCP_length_error_vtable
;
274 DEFINE_THISCALL_WRAPPER(MSVCP_length_error_copy_ctor
, 8)
275 length_error
* __thiscall
MSVCP_length_error_copy_ctor(
276 length_error
*this, length_error
*rhs
)
278 TRACE("%p %p\n", this, rhs
);
279 MSVCP_logic_error_copy_ctor(this, rhs
);
280 this->e
.vtable
= &MSVCP_length_error_vtable
;
284 DEFINE_RTTI_DATA2(length_error
, 0, &logic_error_rtti_base_descriptor
, &exception_rtti_base_descriptor
, ".?AVlength_error@std@@")
285 DEFINE_CXX_DATA2(length_error
, &logic_error_cxx_type_info
, &exception_cxx_type_info
, MSVCP_logic_error_dtor
)
287 /* out_of_range class data */
288 typedef logic_error out_of_range
;
290 static out_of_range
* MSVCP_out_of_range_ctor(
291 out_of_range
*this, const char **name
)
293 TRACE("%p %s\n", this, *name
);
294 MSVCP_logic_error_ctor(this, name
);
295 this->e
.vtable
= &MSVCP_out_of_range_vtable
;
299 DEFINE_THISCALL_WRAPPER(MSVCP_out_of_range_copy_ctor
, 8)
300 out_of_range
* __thiscall
MSVCP_out_of_range_copy_ctor(
301 out_of_range
*this, out_of_range
*rhs
)
303 TRACE("%p %p\n", this, rhs
);
304 MSVCP_logic_error_copy_ctor(this, rhs
);
305 this->e
.vtable
= &MSVCP_out_of_range_vtable
;
309 DEFINE_RTTI_DATA2(out_of_range
, 0, &logic_error_rtti_base_descriptor
, &exception_rtti_base_descriptor
, ".?AVout_of_range@std@@")
310 DEFINE_CXX_DATA2(out_of_range
, &logic_error_cxx_type_info
, &exception_cxx_type_info
, MSVCP_logic_error_dtor
)
312 /* invalid_argument class data */
313 typedef logic_error invalid_argument
;
315 static invalid_argument
* MSVCP_invalid_argument_ctor(
316 invalid_argument
*this, const char **name
)
318 TRACE("%p %s\n", this, *name
);
319 MSVCP_logic_error_ctor(this, name
);
320 this->e
.vtable
= &MSVCP_invalid_argument_vtable
;
324 DEFINE_THISCALL_WRAPPER(MSVCP_invalid_argument_copy_ctor
, 8)
325 invalid_argument
* __thiscall
MSVCP_invalid_argument_copy_ctor(
326 invalid_argument
*this, invalid_argument
*rhs
)
328 TRACE("%p %p\n", this, rhs
);
329 MSVCP_logic_error_copy_ctor(this, rhs
);
330 this->e
.vtable
= &MSVCP_invalid_argument_vtable
;
334 DEFINE_RTTI_DATA2(invalid_argument
, 0, &logic_error_rtti_base_descriptor
, &exception_rtti_base_descriptor
, ".?AVinvalid_argument@std@@")
335 DEFINE_CXX_DATA2(invalid_argument
, &logic_error_cxx_type_info
, &exception_cxx_type_info
, MSVCP_logic_error_dtor
)
337 /* runtime_error class data */
340 basic_string_char str
;
343 static runtime_error
* MSVCP_runtime_error_ctor(
344 runtime_error
*this, const char **name
)
346 TRACE("%p %s\n", this, *name
);
347 this->e
.vtable
= &MSVCP_runtime_error_vtable
;
349 this->e
.do_free
= FALSE
;
350 MSVCP_basic_string_char_ctor_cstr(&this->str
, *name
);
354 DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_copy_ctor
, 8)
355 runtime_error
* __thiscall
MSVCP_runtime_error_copy_ctor(
356 runtime_error
*this, runtime_error
*rhs
)
358 TRACE("%p %p\n", this, rhs
);
359 MSVCP_exception_copy_ctor(&this->e
, &rhs
->e
);
360 MSVCP_basic_string_char_copy_ctor(&this->str
, &rhs
->str
);
361 this->e
.vtable
= &MSVCP_runtime_error_vtable
;
365 DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_dtor
, 4)
366 void __thiscall
MSVCP_runtime_error_dtor(runtime_error
*this)
369 MSVCP_exception_dtor(&this->e
);
370 MSVCP_basic_string_char_dtor(&this->str
);
373 DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_vector_dtor
, 8)
374 void* __thiscall
MSVCP_runtime_error_vector_dtor(
375 runtime_error
*this, unsigned int flags
)
377 TRACE("%p %x\n", this, flags
);
379 /* we have an array, with the number of elements stored before the first object */
380 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
382 for(i
=*ptr
-1; i
>=0; i
--)
383 MSVCP_runtime_error_dtor(this+i
);
384 MSVCRT_operator_delete(ptr
);
386 MSVCP_runtime_error_dtor(this);
388 MSVCRT_operator_delete(this);
394 DEFINE_THISCALL_WRAPPER(MSVCP_runtime_error_what
, 4)
395 const char* __thiscall
MSVCP_runtime_error_what(runtime_error
*this)
398 return MSVCP_basic_string_char_c_str(&this->str
);
401 DEFINE_RTTI_DATA1(runtime_error
, 0, &exception_rtti_base_descriptor
, ".?AVruntime_error@std@@")
402 DEFINE_CXX_DATA1(runtime_error
, &exception_cxx_type_info
, MSVCP_runtime_error_dtor
)
404 /* failure class data */
405 typedef runtime_error failure
;
407 static failure
* MSVCP_failure_ctor(
408 failure
*this, const char **name
)
410 TRACE("%p %s\n", this, *name
);
411 MSVCP_runtime_error_ctor(this, name
);
412 this->e
.vtable
= &MSVCP_failure_vtable
;
416 DEFINE_THISCALL_WRAPPER(MSVCP_failure_copy_ctor
, 8)
417 failure
* __thiscall
MSVCP_failure_copy_ctor(
418 failure
*this, failure
*rhs
)
420 TRACE("%p %p\n", this, rhs
);
421 MSVCP_runtime_error_copy_ctor(this, rhs
);
422 this->e
.vtable
= &MSVCP_failure_vtable
;
426 DEFINE_THISCALL_WRAPPER(MSVCP_failure_dtor
, 4)
427 void __thiscall
MSVCP_failure_dtor(failure
*this)
430 MSVCP_runtime_error_dtor(this);
433 DEFINE_THISCALL_WRAPPER(MSVCP_failure_vector_dtor
, 8)
434 void* __thiscall
MSVCP_failure_vector_dtor(
435 failure
*this, unsigned int flags
)
437 TRACE("%p %x\n", this, flags
);
438 return MSVCP_runtime_error_vector_dtor(this, flags
);
441 DEFINE_THISCALL_WRAPPER(MSVCP_failure_what
, 4)
442 const char* __thiscall
MSVCP_failure_what(failure
*this)
445 return MSVCP_runtime_error_what(this);
448 DEFINE_RTTI_DATA2(failure
, 0, &runtime_error_rtti_base_descriptor
, &exception_rtti_base_descriptor
, ".?AVfailure@std@@")
449 DEFINE_CXX_DATA2(failure
, &runtime_error_cxx_type_info
, &exception_cxx_type_info
, MSVCP_runtime_error_dtor
)
451 /* bad_cast class data */
452 typedef exception bad_cast
;
454 DEFINE_THISCALL_WRAPPER(MSVCP_bad_cast_ctor
, 8)
455 bad_cast
* __thiscall
MSVCP_bad_cast_ctor(bad_cast
*this, const char *name
)
457 TRACE("%p %s\n", this, name
);
458 MSVCP_exception_ctor(this, &name
);
459 this->vtable
= &MSVCP_bad_cast_vtable
;
463 DEFINE_THISCALL_WRAPPER(MSVCP_bad_cast_default_ctor
,4)
464 bad_cast
* __thiscall
MSVCP_bad_cast_default_ctor(bad_cast
*this)
466 return MSVCP_bad_cast_ctor(this, "bad cast");
469 DEFINE_THISCALL_WRAPPER(MSVCP_bad_cast_copy_ctor
, 8)
470 bad_cast
* __thiscall
MSVCP_bad_cast_copy_ctor(bad_cast
*this, const bad_cast
*rhs
)
472 TRACE("%p %p\n", this, rhs
);
473 MSVCP_exception_copy_ctor(this, rhs
);
474 this->vtable
= &MSVCP_bad_cast_vtable
;
478 DEFINE_THISCALL_WRAPPER(MSVCP_bad_cast_dtor
, 4)
479 void __thiscall
MSVCP_bad_cast_dtor(bad_cast
*this)
482 MSVCP_exception_dtor(this);
485 DEFINE_THISCALL_WRAPPER(MSVCP_bad_cast_vector_dtor
, 8)
486 void * __thiscall
MSVCP_bad_cast_vector_dtor(bad_cast
*this, unsigned int flags
)
488 TRACE("%p %x\n", this, flags
);
490 /* we have an array, with the number of elements stored before the first object */
491 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
493 for(i
=*ptr
-1; i
>=0; i
--)
494 MSVCP_bad_cast_dtor(this+i
);
495 MSVCRT_operator_delete(ptr
);
497 MSVCP_bad_cast_dtor(this);
499 MSVCRT_operator_delete(this);
505 DEFINE_THISCALL_WRAPPER(MSVCP_bad_cast_opequals
, 8)
506 bad_cast
* __thiscall
MSVCP_bad_cast_opequals(bad_cast
*this, const bad_cast
*rhs
)
508 TRACE("(%p %p)\n", this, rhs
);
511 MSVCP_exception_dtor(this);
512 MSVCP_exception_copy_ctor(this, rhs
);
517 DEFINE_RTTI_DATA1(bad_cast
, 0, &exception_rtti_base_descriptor
, ".?AVbad_cast@std@@")
518 DEFINE_CXX_DATA1(bad_cast
, &exception_cxx_type_info
, MSVCP_bad_cast_dtor
)
520 /* ?_Nomemory@std@@YAXXZ */
521 void __cdecl
_Nomemory(void)
524 throw_exception(EXCEPTION_BAD_ALLOC
, NULL
);
527 /* ?_Xmem@tr1@std@@YAXXZ */
528 void __cdecl
_Xmem(void)
531 throw_exception(EXCEPTION_BAD_ALLOC
, NULL
);
534 /* ?_Xinvalid_argument@std@@YAXPBD@Z */
535 /* ?_Xinvalid_argument@std@@YAXPEBD@Z */
536 void __cdecl
_Xinvalid_argument(const char *str
)
538 TRACE("(%s)\n", debugstr_a(str
));
539 throw_exception(EXCEPTION_INVALID_ARGUMENT
, str
);
542 /* ?_Xlength_error@std@@YAXPBD@Z */
543 /* ?_Xlength_error@std@@YAXPEBD@Z */
544 void __cdecl
_Xlength_error(const char *str
)
546 TRACE("(%s)\n", debugstr_a(str
));
547 throw_exception(EXCEPTION_LENGTH_ERROR
, str
);
550 /* ?_Xout_of_range@std@@YAXPBD@Z */
551 /* ?_Xout_of_range@std@@YAXPEBD@Z */
552 void __cdecl
_Xout_of_range(const char *str
)
554 TRACE("(%s)\n", debugstr_a(str
));
555 throw_exception(EXCEPTION_OUT_OF_RANGE
, str
);
558 /* ?_Xruntime_error@std@@YAXPBD@Z */
559 /* ?_Xruntime_error@std@@YAXPEBD@Z */
560 void __cdecl
_Xruntime_error(const char *str
)
562 TRACE("(%s)\n", debugstr_a(str
));
563 throw_exception(EXCEPTION_RUNTIME_ERROR
, str
);
566 /* ?uncaught_exception@std@@YA_NXZ */
567 MSVCP_bool __cdecl
MSVCP__uncaught_exception(void)
569 return __uncaught_exception();
573 void __asm_dummy_vtables(void) {
575 __ASM_VTABLE(type_info
,
576 VTABLE_ADD_FUNC(MSVCP_type_info_vector_dtor
));
577 __ASM_VTABLE(exception
,
578 VTABLE_ADD_FUNC(MSVCP_exception_vector_dtor
)
579 VTABLE_ADD_FUNC(MSVCP_what_exception
));
580 __ASM_VTABLE(bad_alloc
,
581 VTABLE_ADD_FUNC(MSVCP_bad_alloc_vector_dtor
)
582 VTABLE_ADD_FUNC(MSVCP_what_exception
));
583 __ASM_VTABLE(logic_error
,
584 VTABLE_ADD_FUNC(MSVCP_logic_error_vector_dtor
)
585 VTABLE_ADD_FUNC(MSVCP_logic_error_what
));
586 __ASM_VTABLE(length_error
,
587 VTABLE_ADD_FUNC(MSVCP_logic_error_vector_dtor
)
588 VTABLE_ADD_FUNC(MSVCP_logic_error_what
));
589 __ASM_VTABLE(out_of_range
,
590 VTABLE_ADD_FUNC(MSVCP_logic_error_vector_dtor
)
591 VTABLE_ADD_FUNC(MSVCP_logic_error_what
));
592 __ASM_VTABLE(invalid_argument
,
593 VTABLE_ADD_FUNC(MSVCP_logic_error_vector_dtor
)
594 VTABLE_ADD_FUNC(MSVCP_logic_error_what
));
595 __ASM_VTABLE(runtime_error
,
596 VTABLE_ADD_FUNC(MSVCP_runtime_error_vector_dtor
)
597 VTABLE_ADD_FUNC(MSVCP_runtime_error_what
));
598 __ASM_VTABLE(failure
,
599 VTABLE_ADD_FUNC(MSVCP_failure_vector_dtor
)
600 VTABLE_ADD_FUNC(MSVCP_failure_what
));
601 __ASM_VTABLE(bad_cast
,
602 VTABLE_ADD_FUNC(MSVCP_bad_cast_vector_dtor
)
603 VTABLE_ADD_FUNC(MSVCP_what_exception
));
608 /* Internal: throws selected exception */
609 void throw_exception(exception_type et
, const char *str
)
611 const char *addr
= str
;
614 case EXCEPTION_RERAISE
:
615 _CxxThrowException(NULL
, NULL
);
618 MSVCP_exception_ctor(&e
, &addr
);
619 _CxxThrowException(&e
, &exception_cxx_type
);
621 case EXCEPTION_BAD_ALLOC
: {
623 MSVCP_bad_alloc_ctor(&e
, &addr
);
624 _CxxThrowException(&e
, &bad_alloc_cxx_type
);
626 case EXCEPTION_LOGIC_ERROR
: {
628 MSVCP_logic_error_ctor(&e
, &addr
);
629 _CxxThrowException((exception
*)&e
, &logic_error_cxx_type
);
631 case EXCEPTION_LENGTH_ERROR
: {
633 MSVCP_length_error_ctor(&e
, &addr
);
634 _CxxThrowException((exception
*)&e
, &length_error_cxx_type
);
636 case EXCEPTION_OUT_OF_RANGE
: {
638 MSVCP_out_of_range_ctor(&e
, &addr
);
639 _CxxThrowException((exception
*)&e
, &out_of_range_cxx_type
);
641 case EXCEPTION_INVALID_ARGUMENT
: {
643 MSVCP_invalid_argument_ctor(&e
, &addr
);
644 _CxxThrowException((exception
*)&e
, &invalid_argument_cxx_type
);
646 case EXCEPTION_RUNTIME_ERROR
: {
648 MSVCP_runtime_error_ctor(&e
, &addr
);
649 _CxxThrowException((exception
*)&e
, &runtime_error_cxx_type
);
651 case EXCEPTION_FAILURE
: {
653 MSVCP_failure_ctor(&e
, &addr
);
654 _CxxThrowException((exception
*)&e
, &failure_cxx_type
);
659 void init_exception(void *base
)
662 init_type_info_rtti(base
);
663 init_exception_rtti(base
);
664 init_bad_alloc_rtti(base
);
665 init_logic_error_rtti(base
);
666 init_length_error_rtti(base
);
667 init_out_of_range_rtti(base
);
668 init_invalid_argument_rtti(base
);
669 init_runtime_error_rtti(base
);
670 init_failure_rtti(base
);
671 init_bad_cast_rtti(base
);
673 init_exception_cxx(base
);
674 init_bad_alloc_cxx(base
);
675 init_logic_error_cxx(base
);
676 init_length_error_cxx(base
);
677 init_out_of_range_cxx(base
);
678 init_invalid_argument_cxx(base
);
679 init_runtime_error_cxx(base
);
680 init_failure_cxx(base
);
681 init_bad_cast_cxx(base
);