Classification: |
C++ |
Category: |
Base |
Created: |
09/12/2000 |
Modified: |
12/11/2001 |
Number: |
FAQ-0517 |
Platform: |
ER5 |
|
Question: Can I obtain a return code other than zero from E32Main in a WINC executable?
Answer: This is possible, although it is not straight forward. The _E32Startup() function ignores the E32Main() return value under
WINS and calls E32ExitProcess() which in turn calls the Win32 function ExitProcess(), passing zero as the return code. However,
you could achieve the desired effect by doing the following:
#include GLDEF_C TInt E32Main() // main function called by E32
{ ExitProcess(2); return 2; }
The executable will have to be linked to Win32 Library kernel32.lib. Although the side effect of this will be that the process
is exited without calling E32DeInitialize() and other "clean up" functions. To link to kernel32.lib via a makmake-generated
makefile, you can add the following to your .mmp file:
START WINS
WIN32_LIBRARY kernel32.libEND
|