		#include "EXTERN.h"
		#include "perl.h"
		
		#define NO_XSLOCKS
		#include "XSUB.h"
		
		static void throws_exception(int throw_e)
           2    {
           2      if (throw_e)
           1        croak("boo\n");
		}
		
		int exception(int throw_e)
           2    {
		  dTHR;
           2      dXCPT;
           2      SV *caught = get_sv("XS::APItest::exception_caught", 0);
		
           2      XCPT_TRY_START {
           2        throws_exception(throw_e);
           2      } XCPT_TRY_END
		
           2      XCPT_CATCH
		  {
           1        sv_setiv(caught, 1);
           1        XCPT_RETHROW;
		  }
		
           1      sv_setiv(caught, 0);
		
           1      return 42;
		}
		
