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\include\win32atx.h
23 #ifndef __WIN32ATX_H__
24 #define __WIN32ATX_H__
28 #define MAX_ATEXIT_HANDLERS 255
30 #ifdef __KERNEL_MODE__
31 #define PANIC() Kern::Fault("ATEXIT", __LINE__)
33 _LIT(KLitAtExitPanic,"ATEXIT");
34 #define PANIC() User::Panic(KLitAtExitPanic, __LINE__)
38 typedef void (__cdecl* TAtExit)(void);
40 static TAtExit handlers[MAX_ATEXIT_HANDLERS];
42 int atexit(TAtExit aFunc)
44 if (sp>=MAX_ATEXIT_HANDLERS)
50 void __call_atexit_handlers()
56 #pragma data_seg(".CRT$XPU")
57 TAtExit __xp_a[] = { __call_atexit_handlers };
61 #elif defined(__CW32__)
63 struct SDestructorEntry
65 SDestructorEntry* iNext;
70 SDestructorEntry* DEListHead;
74 void* __register_global_object(void* obj, void* dfn, void* entry)
76 SDestructorEntry* e = (SDestructorEntry*)entry;
77 e->iNext = DEListHead;
84 __declspec(naked) void __destroy_global_chain(void)
89 _asm lea ebx, DEListHead
95 _asm call dword ptr [ebx+4]
98 _asm lea ebx, DEListHead
106 #pragma data_seg(".CRT$XPU")
107 void (*__xp_a[])(void) = { &__destroy_global_chain };
110 #elif defined(__GCC32__)
111 // todo: figure out what to do here
113 #error Unknown X86 compiler