[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Raising an exception within C?



Quoting Richard Cobbe:
> I know how to define the structs that I'm going to use as exception
> objects, but it's unclear how to raise those from within C, as
> scheme_raise_exn doesn't seem to apply here.  Is this in fact possible, or
> do I have to return an error code out to a Scheme wrapper function which
> then throws the appropriate object?

Seems like scheme_raise() (= `raise' in Scheme) should be in the
exported C interface, but it isn't.

There is such a function; I've moved the prototype from schpriv.h to
schemef.h, so it will be accessible in the next release.

Meanwhile, if you're in Linux, scheme_raise() is actually accessible
already, just not prototyped. Under Windows, you'd have to rebuild the
binary.

In any case, you could use the usual trick of looking up "#%raise" in
some environment.

Matthew