First public contribution.
     1 // Copyright (c) 1998-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".
 
     8 // Initial Contributors:
 
     9 // Nokia Corporation - initial contribution.
 
    14 // EPOC32 version of crt0.c for pure C programs, adapted to cause the full Eikon
 
    15 // environment to come into being and hence only used with WINS.
 
    26 extern "C" int main (int argc, char *argv[], char *envp[]);
 
    29 IMPORT_C void RegisterWsExe(const TDesC &aName);
 
    32 GLDEF_C TInt E32Main()
 
    36 	RWin32Stream::StartServer();	// arrange for access to Win32 stdin/stdout/stderr
 
    37 	SpawnPosixServerThread();	// arrange for multi-threaded operation
 
    43 	__crt0(argc,argv,envp);			// get args & environment from somewhere
 
    46 	// Cause the graphical Window Server to come into existence
 
    48 	sem.CreateGlobal(_L("WsExeSem"),0);
 
    49 	RegisterWsExe(sem.FullName());
 
    52 	int ret=main(argc, argv, envp);		// go
 
    54 	// no need to explicitly delete the cleanup stack here as all memory used by
 
    55 	// the process will be released by RProcess::Terminate(), called from inside exit().
 
    57 	exit(ret);	// to get atexit processing, eventually terminates this process