diff --git a/include/mruby/throw.h b/include/mruby/throw.h index 52171e9b0..8ec1aa7ae 100644 --- a/include/mruby/throw.h +++ b/include/mruby/throw.h @@ -52,14 +52,15 @@ typedef mrb_int mrb_jmpbuf_impl; #endif +#if defined(MRB_USE_CXX_EXCEPTION) +extern mrb_int mrb_jmpbuf_id; +#endif + struct mrb_jmpbuf { mrb_jmpbuf_impl impl; #if defined(MRB_USE_CXX_EXCEPTION) - static mrb_int jmpbuf_id; -# if defined(__cplusplus) - mrb_jmpbuf() : impl(jmpbuf_id++) {} -# endif + mrb_jmpbuf() : impl(mrb_jmpbuf_id++) {} #endif }; diff --git a/src/vm.c b/src/vm.c index 553e68b11..586585079 100644 --- a/src/vm.c +++ b/src/vm.c @@ -3127,5 +3127,5 @@ mrb_top_run(mrb_state *mrb, const struct RProc *proc, mrb_value self, mrb_int st # if !defined(MRB_USE_CXX_ABI) } /* end of extern "C" */ # endif -mrb_int mrb_jmpbuf::jmpbuf_id = 0; +mrb_int mrb_jmpbuf_id = 0; #endif