Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1069129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:22:24+00:00 2026-05-16T20:22:24+00:00

I have build a Ruby extension in Objective-C. Now I want to use @throw/@catch

  • 0

I have build a Ruby extension in Objective-C. Now I want to use @throw/@catch etc. instead of macro based exception handling and self build error handling.

I am using the GNU runtime shipped with the GCC.
When I run my Ruby app with my extension it core dumps as soon as an exception occurs. The abort() comes from the GNU Objective-C runtime (libobjc/exception.c:375):

void
objc_exception_throw (id value)
{
  struct ObjcException *header = calloc (1, sizeof (*header));
  header->base.exception_class = __objc_exception_class;
  header->base.exception_cleanup = __objc_exception_cleanup;
  header->value = value;

#ifdef SJLJ_EXCEPTIONS
  _Unwind_SjLj_RaiseException (&header->base);
#else
  _Unwind_RaiseException (&header->base);
#endif

  /* Some sort of unwinding error.  */
  abort ();
}

Since I compiled with -fobjc-exceptions I think _Unwind_RaiseException is being called.

Is there any way to use the Objective-C exceptions in a Ruby extension?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:22:25+00:00Added an answer on May 16, 2026 at 8:22 pm

    Problem solved:

    The GNU Objective-C runtime does not handle the result of _Unwind_(SjLj_)RaiseException (see code above). In my case it returned 5 which stands for “end of stack” and means that I had forgotten a @try/@catch block.

    There really should be some logging or a hook to do it self.

    Update:

    Unless one compiles Ruby with -fobjc-exceptions the Objective-C exception handling cannot trace the stack through Ruby code. Therefore you must be aware to catch and wrap or translate any Objective-C exception before giving control to Ruby.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have build my very first application to Android and I want now to
I have a clean build system as follows Ubuntu 11.04 Rvm 1.13.5 Ruby 1.9.3p194
I have a C extension module for Python and I want to make it
I have a site built in Ruby On Rails which has many ads in
I have built a very simple blog application using Ruby on Rails. New to
How to convert Ruby Hash to C# Dictionary? Do we have any built-in function...or
i have build a small function whose work to get value in alert box
I have build C# program that work with RAPI (communication to PPC or WinCE)
I have build a webapplication using ASP.NET MVC and JQuery. On my local machine
I have build a c# class library verification.dll using OpenCVSharp. This references OpenCvSharp.dll in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.