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

  • SEARCH
  • Home
  • 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 8999831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:13:56+00:00 2026-06-16T00:13:56+00:00

I have a C++ library for Network communication that I need to port for

  • 0

I have a C++ library for Network communication that I need to port for Mac, previously this library was used on Windows C++ app.

The flow of the C++ Network Lib is based on Exceptions in case of errors, instead of returning error code or last error..

Now since on Mac we use Objective-C/C++ for apps. I need to have UI in Objective-C/C++ but the lib used for the core network functionality is the same C++ lib.

So my question is will the objective C be able to handle exceptions thrown by C++ calls ? if so , how ? if not how do I resolve it ?
Or do we write a wrapper around C++ Lib calls and consume exceptions and return error codes ?

Please advise, how to solve it..

  • 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-06-16T00:13:56+00:00Added an answer on June 16, 2026 at 12:13 am

    Provided you’re using iOS or the 64-bit runtime on OS X, things pretty much just work. You can write a C++ style try/catch and it will work as expected, as will @try/@catch. Note that you’ll still have the two distinct styles, for Objective-C and C++ exceptions; the only unification is the special case where a catch(...) or @catch(...) catches all exceptions, Objective-C or C++. That’s marginally useful for centralising your clean-up code, but about all you can then do with the exception itself is @throw it blindly again.

    But in any case, exceptions shouldn’t be used for flow control in Objective-C (or Objective-C++) programs. You should indeed endeavour to trap the C++ exceptions as they exit the library in question and convert them to a more appropriate mechanism, such as NSError. In particular, avoid letting any of them raise through any Apple or 3rd party frameworks – most such frameworks are not exception safe for Objective-C exceptions, let alone C++ ones, and the consequences are thus undefined (mostly revolving around memory leaks, though many other failures are possible).

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

Sidebar

Related Questions

I have a library made in C++/GDI that I am trying to port to
I have an Android library project and the main application that uses this library
I have enabled .NET network tracing per this article here: http://msdn.microsoft.com/en-us/library/ty48b824.aspx Unfortunately, the log
I have written complex library for managing network communication based on iocp mechanism. Problem
I have a library method that occasionally hangs on a network connection, and there's
I have a library that is a complicated arbiter of many network connections. Each
I have developed direct3D video rendering library that is used for rendering video in
I have a couple Windows computers on my network that will be running a
I have a library project that should be the base for several web applications.
We have a library created as both .lib and .dll (it's a big library

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.