// APPRUN.CPP
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//

#include <eikdll.h>
#include <apacmdln.h>
#include <e32svr.h>

#if defined(__WINS__)
//
EXPORT_C TInt EntryPoint(TAny* aCmdLine)
	{
	TPtrC commandLineDes=*((TDesC*)aCmdLine);
	CTrapCleanup* TheTrapCleanup=CTrapCleanup::New();
	CApaCommandLine* cmdLine=NULL;
	TRAPD(err, cmdLine=CApaCommandLine::NewL(commandLineDes));
	if (!cmdLine)
		return KErrNoMemory;
	EikDll::RunAppInsideThread(cmdLine);  // takes ownership
	delete TheTrapCleanup;
	return(KErrNone);
	}
//
#else
//
LOCAL_C CApaCommandLine* CommandLine()
	{
	HBufC* commandLineDes=RProcess().CommandLine().Alloc();
	if (!commandLineDes)
		return NULL;
	CApaCommandLine* cmdLine=CApaCommandLine::New(commandLineDes);	// takes ownership
	return cmdLine;
	}

GLDEF_C TInt E32Main()
	{
	CApaCommandLine* cmdLine=CommandLine();
	if (!cmdLine)
		return KErrNoMemory;
	EikDll::RunAppInsideThread(cmdLine); // takes ownership
	return(KErrNone);
	}
//
#endif

#if defined(__WINS__)
GLDEF_C TInt E32Dll(TDllReason)
	{
	return(KErrNone);
	}
#endif
