equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * toplevel destruction routines for 'user side' code compiled |
|
16 * with the ARMEDG compiler. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #include "cppinit.h" |
|
22 |
|
23 extern "C" { |
|
24 |
|
25 // Need to decide what this should do |
|
26 //void CppInitializationPanic(){}; |
|
27 |
|
28 #define MAX_DTOR_RECORDS 256 |
|
29 static dtd dtor_rec[MAX_DTOR_RECORDS]; |
|
30 |
|
31 typedef dtd **dso_handle; |
|
32 dtd * __dso_handle = &dtor_rec[MAX_DTOR_RECORDS]; |
|
33 |
|
34 int __cxa_atexit ( void (*f)(void *), void *p, dso_handle d ) |
|
35 { |
|
36 dtd * drec = *d; |
|
37 drec--; |
|
38 // This is what the spec says to do!! |
|
39 if (drec < &dtor_rec[0]) return -1; |
|
40 |
|
41 drec->dtor = f; |
|
42 drec->obj = p; |
|
43 *d = drec; |
|
44 return 0; |
|
45 } |
|
46 |
|
47 void __cxa_finalize ( dso_handle d ) |
|
48 { |
|
49 dtd * drec = * d; |
|
50 dtd * lim = &dtor_rec[MAX_DTOR_RECORDS]; |
|
51 while (drec < lim) |
|
52 { |
|
53 drec->dtor(drec->obj); |
|
54 drec++; |
|
55 } |
|
56 *d = drec; |
|
57 } |
|
58 |
|
59 void run_static_dtors (void) |
|
60 { |
|
61 __cxa_finalize(&__dso_handle); |
|
62 } |
|
63 } |
|
64 |