Usual exe servers run on WINS can't have access to the system servers such as ECom, DBMS, Window server, etc. EXEDLL projects help to cope with this problem.
Generally, exe programs are used to implement servers or simple console programs. When you start an exe program on WINS, emulator launches in a very limited mode with the text console and almost no system services enabled. It might be sufficient for test programs, but makes it rather difficult to develop sophisticated exe servers.
To overcome the problem you can use the EXEDLL project target. It compiles into EXE for hardware environments and into DLL for WINS. It means that you can launch them from the fully loaded emulator. You can use the ExeLauncher for it.
In MMP file:
TARGET HelloExeDll.dll
TARGETTYPE exedll
TARGETPATH \SYSTEM\PROGRAMS
In CPP file:
GLDEF_C TInt Start()
{
// Create cleanup stack
__UHEAP_MARK;
CTrapCleanup* cleanup = CTrapCleanup::New();
// Create output console
TRAPD(createError, console = Console::NewL(KTextConsoleTitle,\
TSize(KConsFullScreen,KConsFullScreen)));
if (createError)
return createError;
// Run application code inside TRAP harness, wait keypress when terminated
TRAPD(mainError, DoStartL());
if (mainError)
console->Printf(KTextFailed, mainError);
console->Printf(KTextPressAnyKey);
console->Getch();
delete console;
delete cleanup;
__UHEAP_MARKEND;
return KErrNone;
}
// Exported Functions
#ifdef __WINS__
EXPORT_C TInt WinsMain(TAny* /*aParam*/)
{
return Start();
}
#else
GLDEF_C TInt E32Main()
{
return Start();
}
#endif
#ifdef __WINS__
TInt E32Dll(TDllReason /*aReason*/)
{
return KErrNone;
}
#endif
| Attachment | Size |
|---|---|
| HelloExeDll.zip | 5.23 KB |