PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Runtime Error handling question.

I have been doing some runtime error handling checkup (__try/except) in my code and it's been working good on the emulator in debug mode, but with the device build it doesn't work, the application just exists. Do I need to include compiler switches or something?

Thanks for the help in advance.

Regards,
Kornalius
angedelamort · 28 Apr 2004, 13:34 UTC
I know that try/catch are not supported in windowsCE, but __try and __except should work.
Very strange AngeDeLaMort because I am using __try / __except. On the emulator it works but on PPC it doesn't.

Regards,
Kornalius

Btw, I am from Montreal too! Salut! :D
__try/__cacth works on the PPC. I use it inside PocketHAL and didn't experience any problems with it.
Maybe __try / __except needs a special compiler directive here is my code:

Code:
__try
{
if (proc != NULL)
{
if (proc[0] == '*')
(p)();
else
(p)();
}
else
(p)();
}
__except (Eval_Exception(proc, GetExceptionCode(), GetExceptionInformation()))
{
}


Regards,
Kornalius
Anyone?
angedelamort · 29 Apr 2004, 13:52 UTC
sorry, but everything seems normal...

What I use is almost the same...

__try, __finally, __except and __leave

Maybe you can add the case finally...
I'll keep on trying, thanks for the tips. :)
i have similar problems. with dynamic generated code exception handling doesn't work. i think this is because under arm no additional code is inserted for __try (example x86 changes the fs:[0] pointer. i think). only exceptions information is added to the exception directory of the win32 pe file (for a dynamic code this is obviously missing) and somehow wince finds out from the registers and stack (and from who knows what) where to pass the exception. does anybody know more about this or has some advice?
joshbu [MSFT] · 10 May 2004, 18:03 UTC
kornalius, are you also using dynamic code generation?

As picard points out, the stack unwinder has no idea how to unwind the stack when an exception arises in dynamically generated code. (Usually the stack unwinder uses information generated by the compiler when the exception handling switch is on.)

There is no good solution for this problem in CE 4.x. We are looking into this for 5.0.

If I come accross a work around, I'll let you guys know.
Thanks for the info, I thought I was nuts at first, I guess this explains why. Thanks for all the help, I hope it will be fixed in 5.0 too! :wink:

Regards,
Kornalius