0
|
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\win32\uc_dll.cpp
|
|
15 |
// This file contains the DLL entrypoint
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#include "u32std.h"
|
|
20 |
|
|
21 |
typedef void* HANDLE;
|
|
22 |
|
|
23 |
#ifdef __VC32__
|
|
24 |
#define __FLTUSED
|
|
25 |
#endif //__VC32__
|
|
26 |
|
|
27 |
#ifdef __CW32__
|
|
28 |
|
|
29 |
struct SDestructorEntry;
|
|
30 |
extern SDestructorEntry* DEListHead;
|
|
31 |
|
|
32 |
TBool InitCWRuntime();
|
|
33 |
TBool CleanupCWRuntime();
|
|
34 |
|
|
35 |
#define WIN32_LEAN_AND_MEAN
|
|
36 |
#include <windows.h>
|
|
37 |
|
|
38 |
// DLL entry point
|
|
39 |
extern "C"
|
|
40 |
BOOL WINAPI _Win32DllMain(HINSTANCE, DWORD fdwReason, LPVOID)
|
|
41 |
{
|
|
42 |
if (fdwReason == DLL_PROCESS_DETACH)
|
|
43 |
{
|
|
44 |
DEListHead = NULL; // prevent destruction of static data after process has died
|
|
45 |
return CleanupCWRuntime();
|
|
46 |
}
|
|
47 |
else
|
|
48 |
return 1;
|
|
49 |
}
|
|
50 |
|
|
51 |
#endif //__CW32__
|
|
52 |
|
|
53 |
// include the static data definitions
|
|
54 |
#include "win32crt.h"
|
|
55 |
|
|
56 |
// include compiler helpers
|
|
57 |
#include "x86hlp.inl"
|
|
58 |
|
|
59 |
extern "C"
|
|
60 |
EXPORT_C TInt _E32Dll(TInt aReason)
|
|
61 |
{
|
|
62 |
if (aReason==KModuleEntryReasonProcessAttach)
|
|
63 |
{
|
|
64 |
#ifdef __CW32__
|
|
65 |
if (!InitCWRuntime())
|
|
66 |
return KErrGeneral;
|
|
67 |
DEListHead = NULL;
|
|
68 |
#endif //__CW32__
|
|
69 |
constructStatics();
|
|
70 |
}
|
|
71 |
if (aReason==KModuleEntryReasonProcessDetach)
|
|
72 |
{
|
|
73 |
destroyStatics();
|
|
74 |
#ifdef __CW32__
|
|
75 |
DEListHead = NULL;
|
|
76 |
#endif //__CW32__
|
|
77 |
}
|
|
78 |
return KErrNone;
|
|
79 |
}
|