From: Sean O'Dell Date: 2003-06-20T02:27:31+09:00 Subject: Re: rb_protect and longjmp "Paul Brannan" wrote in message news:20030619170716.GQ1747@atdesk.com... > On Thu, Jun 19, 2003 at 08:17:53AM +0900, Sean O'Dell wrote: > > Looking for some insight about rb_protect and the longjmp calls. > > > > Is rb_protect supposed to always return back to the caller? I'm > > wrapping calls in rb_protect wherever I can in my C++ application, but > > it seems that rb_protect doesn't always return. > > When rb_protect "doesn't return" what does happen? Does your code get > jumped over or does the program hang or does it crash? > > I know that if you throw a C++ exception from inside an rb_protect call, > then on some platforms (g++ under Linux is one), std::terminate() will > be called. Well, now I'm trying to determine when it does what. A simple test from the top of the app works fine; rb_protect returns even though it called a function that called rb_raise, but when I do the same thing from within a ruby callback (my application embeds ruby as well as extends it, so this ruby callback is actually a class method) rb_protect isn't protecting anything; rb_protect never returns, as if I were calling rb_raise directly. I think in one other place in my code where I did this, the program actually just crashed. I'm thinking there must be something goofy with the .dll build. It works trouble-free 98% of the time, but every so often something completely unexpected happens like an invalid address access or something. I'm guessing I may need to double-check my compile options or something. Sean O'Dell