sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\euser\epoc\win32\uc_dll.cpp sl@0: // This file contains the DLL entrypoint sl@0: // sl@0: // sl@0: sl@0: #include "u32std.h" sl@0: sl@0: typedef void* HANDLE; sl@0: sl@0: #ifdef __VC32__ sl@0: #define __FLTUSED sl@0: #endif //__VC32__ sl@0: sl@0: #ifdef __CW32__ sl@0: sl@0: struct SDestructorEntry; sl@0: extern SDestructorEntry* DEListHead; sl@0: sl@0: TBool InitCWRuntime(); sl@0: TBool CleanupCWRuntime(); sl@0: sl@0: #define WIN32_LEAN_AND_MEAN sl@0: #include sl@0: sl@0: // DLL entry point sl@0: extern "C" sl@0: BOOL WINAPI _Win32DllMain(HINSTANCE, DWORD fdwReason, LPVOID) sl@0: { sl@0: if (fdwReason == DLL_PROCESS_DETACH) sl@0: { sl@0: DEListHead = NULL; // prevent destruction of static data after process has died sl@0: return CleanupCWRuntime(); sl@0: } sl@0: else sl@0: return 1; sl@0: } sl@0: sl@0: #endif //__CW32__ sl@0: sl@0: // include the static data definitions sl@0: #include "win32crt.h" sl@0: sl@0: // include compiler helpers sl@0: #include "x86hlp.inl" sl@0: sl@0: extern "C" sl@0: EXPORT_C TInt _E32Dll(TInt aReason) sl@0: { sl@0: if (aReason==KModuleEntryReasonProcessAttach) sl@0: { sl@0: #ifdef __CW32__ sl@0: if (!InitCWRuntime()) sl@0: return KErrGeneral; sl@0: DEListHead = NULL; sl@0: #endif //__CW32__ sl@0: constructStatics(); sl@0: } sl@0: if (aReason==KModuleEntryReasonProcessDetach) sl@0: { sl@0: destroyStatics(); sl@0: #ifdef __CW32__ sl@0: DEListHead = NULL; sl@0: #endif //__CW32__ sl@0: } sl@0: return KErrNone; sl@0: }