Re: Throwing exceptions from XS code

[email protected] (Steffen Mueller)
Newsgroups perl.xs
Message-ID <[email protected]>
On 10/26/2011 09:11 PM, Emmanuel Rodriguez wrote:
> Is it possible to throw an blessed exception from XS code? If so how
> can I achieve this? Otherwise, how can I propagate an error as a
> string and free the string?

Haven't tried myself, but: Set $@ yourself and then croak(NULL). From 
perlapi.pod:

                   errsv = get_sv("@", GV_ADD);
                   sv_setsv(errsv, exception_object);
                   croak(NULL);

See the "croak" docs in perlapi.

--Steffen
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.