Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\euser\epoc\win32\uc_exe.cpp
19 #include <e32std_private.h>
28 // include the static data definitions
31 // include compiler helpers
35 We use this class to execute code before and after "main".
45 GLREF_C TInt E32Main();
48 void globalDestructorFunc()
50 destroyStatics(); // this is a macro
55 EXPORT_C TInt _E32Startup(TInt aReason, TAny* aInfo)
57 // Ordinal 1 - the EPOC executable entrypoint
60 if (TUint(aReason)<=TUint(KModuleEntryReasonThreadInit))
62 SStdEpocThreadCreateInfo& cinfo = *(SStdEpocThreadCreateInfo*)aInfo;
64 #ifdef USE_INSTRUMENTED_HEAP
65 cinfo.iFlags |= ETraceHeapAllocs;
66 #elif defined(ENABLE_HEAP_MONITORING)
67 cinfo.iFlags |= ETraceHeapAllocs|EMonitorHeapMemory;
69 TInt r = UserHeap::SetupThreadHeap( (aReason!=KModuleEntryReasonProcessInit), cinfo);
72 // r = UserSvr::DllSetTls(KGlobalDestructorTlsKey, KDllUid_Special, (TAny*)globalDestructorFunc);
76 if (aReason==KModuleEntryReasonProcessInit)
78 // Init statics for implicitly linked DLLs
83 // Init statics for EXE
90 r = (*cinfo.iFunction)(cinfo.iPtr);
94 if (aReason==KModuleEntryReasonException)
96 User::HandleException(aInfo);
107 #define WIN32_LEAN_AND_MEAN
111 ////Prevent early static init on win32
113 Our Symbian OS EXEs are in fact Windows DLLs.
116 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
122 int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
124 //Should never be run
137 TExeInit::~TExeInit()