|
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32\euser\epoc\arm\uc_dll.cpp |
|
15 // This file contains the DLL entrypoint |
|
16 // |
|
17 // |
|
18 |
|
19 #include "u32std.h" |
|
20 |
|
21 |
|
22 extern "C" { |
|
23 |
|
24 #if defined(__GCC32__) |
|
25 |
|
26 typedef void (*PFV)(); |
|
27 extern PFV __CTOR_LIST__[]; |
|
28 extern PFV __DTOR_LIST__[]; |
|
29 |
|
30 GLDEF_C TInt _E32Dll_Body(TInt aReason) |
|
31 { |
|
32 if (aReason==KModuleEntryReasonProcessAttach) |
|
33 { |
|
34 TUint i=1; |
|
35 while (__CTOR_LIST__[i]) |
|
36 (*__CTOR_LIST__[i++])(); |
|
37 } |
|
38 else if (aReason==KModuleEntryReasonProcessDetach) |
|
39 { |
|
40 TUint i=1; |
|
41 while (__DTOR_LIST__[i]) |
|
42 (*__DTOR_LIST__[i++])(); |
|
43 } |
|
44 return 0; |
|
45 } |
|
46 |
|
47 #elif defined(__ARMCC__) |
|
48 |
|
49 void __DLL_Export_Table__(void); |
|
50 void __cpp_initialize__aeabi_(void); |
|
51 __weak void run_static_dtors(void); |
|
52 |
|
53 GLDEF_C TInt _E32Dll_Body(TInt aReason) |
|
54 { |
|
55 if (aReason==KModuleEntryReasonProcessAttach) |
|
56 { |
|
57 __DLL_Export_Table__(); |
|
58 __cpp_initialize__aeabi_(); |
|
59 } |
|
60 else if (aReason==KModuleEntryReasonProcessDetach) |
|
61 { |
|
62 int call_static_dtors = (int)run_static_dtors; |
|
63 if (call_static_dtors) run_static_dtors(); |
|
64 return KErrNone; |
|
65 } |
|
66 return 0; |
|
67 } |
|
68 |
|
69 #else |
|
70 #error not supported |
|
71 #endif |
|
72 |
|
73 } // extern "C" |
|
74 |