|
1 /* |
|
2 * Copyright (c) 2004-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 * e32\compsupp\symaehabi\callfirstprocessfn.cpp |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "unwind_env.h" |
|
21 #include "unwinder.h" |
|
22 #include "symbian_support.h" |
|
23 #include <e32panic.h> |
|
24 |
|
25 #ifdef __LEAVE_EQUALS_THROW__ |
|
26 _LIT(KLitUser,"USER"); |
|
27 #endif |
|
28 |
|
29 TInt E32Main(); |
|
30 |
|
31 #ifdef __KERNEL_MODE__ |
|
32 #error This file should not be compiled in kernel mode |
|
33 #endif |
|
34 |
|
35 extern "C" { |
|
36 |
|
37 void __cpp_initialize__aeabi_(); |
|
38 void __DLL_Export_Table__(); |
|
39 |
|
40 TInt CallThrdProcEntry(TInt (*aFn)(void*), void* aPtr, TInt aNotFirst) |
|
41 { |
|
42 TCppRTExceptionsGlobals aExceptionGlobals; |
|
43 |
|
44 if (!aNotFirst) |
|
45 { |
|
46 // Init statics for implicitly linked DLLs |
|
47 User::InitProcess(); |
|
48 |
|
49 // Init statics for EXE |
|
50 //pick up export table if we're an exexp |
|
51 __DLL_Export_Table__(); |
|
52 __cpp_initialize__aeabi_(); |
|
53 } |
|
54 #ifdef __LEAVE_EQUALS_THROW__ |
|
55 TInt r = KErrNone; |
|
56 |
|
57 try { |
|
58 r = aNotFirst ? (*aFn)(aPtr) : E32Main(); |
|
59 } |
|
60 catch (XLeaveException&) |
|
61 { |
|
62 User::Panic(KLitUser, EUserLeaveWithoutTrap); |
|
63 } |
|
64 |
|
65 return r; |
|
66 #else |
|
67 return aNotFirst ? (*aFn)(aPtr) : E32Main(); |
|
68 #endif |
|
69 } |
|
70 } |