[plt-scheme] How to do exception catching in C code?

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Sun Jun 1 08:37:03 EDT 2008

Chiyuan Zhang wrote:
> Hi all,
> I'm embedding mzscheme to other program. I want to handle the
> exception and know precisely what happened. I found in the
> "Exceptions and Escape Continuations" chapter that the simplest way is
> to mix Scheme code with C code. I tried that way and found I was
> encountering some strange errors. I'm not sure what part of my code
> has something wrong, but I'm also concerning that there will be a
> performance issue with this method.

My first choice would be to handle the exception in Scheme code instead 
of mix Scheme with C. Actually my first choice will be to live in Scheme 
at all and not bothered with C. But that's kind of off topic.

I don't think there is a performance issue with this method.

> So I would like to try the "harder" way. It is mentioned that there
> are parameters like "MZCONFIG_ERROR_DISPLAY_HANDLER",
> "MZSCHEME_INIT_EXN_HANDLER" etc. But where can I find some more
> details about those parameters? I.e. what exactly do they do? If I
> want to install my own handler, what prototype and conventions should
> they follow?
> Any hints?
Still, assuming you are using PLT Scheme v372, section of PLT 
MzScheme: Language Manual is what you should read.


Posted on the users mailing list.