os/ossrv/genericopenlibs/cstdlib/UCRT/WECRT0.CPP
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1997-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 "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 // EPOC32 version of crt0.c for pure C programs
    15 // 
    16 //
    17 
    18 #include <e32std.h>
    19 #include <e32base.h>
    20 #include <estlib.h>
    21 #include <stdlib.h>
    22 
    23 extern "C" int wmain (int argc, wchar_t *argv[], wchar_t *envp[]);
    24 
    25 GLDEF_C TInt E32Main()
    26 	{     
    27 	CTrapCleanup::New();
    28 
    29 	int argc=0;
    30 	wchar_t** argv=0;
    31 	wchar_t** envp=0;
    32 
    33 
    34 	__crt0(argc,argv,envp);			// get args & environment from somewhere
    35 
    36 	int ret=wmain(argc, argv, envp);		// go
    37 
    38 	// no need to explicitly delete the cleanup stack here as all memory used by
    39 	// the process will be released by RProcess::Terminate(), called from inside exit().
    40 
    41 	exit(ret);				// finish with atexit processing
    42 
    43 	return(KErrNone);
    44 	}
    45 
    46 
    47 #ifdef __GCC32__
    48 
    49 /* stub function inserted into main() by GCC */
    50 #ifdef __MCORE__
    51 extern "C" void __main (void) {}
    52 #else
    53 extern "C" void __gccmain (void) {}
    54 #endif
    55 
    56 /* Default GCC entrypoint */
    57 extern "C" TInt _mainCRTStartup (void) 
    58     {
    59     extern TInt _E32Startup();
    60     return _E32Startup();
    61     }
    62 
    63 #endif /* __GCC32__ */