473,569 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

catching unmanaged c++ exceptions

Hi,

How do i catch an unmanaged c++ exceptions ?
right now i can catch the System.Runtime. InteropServices .SEHException and
System.Exceptio n exceptions , but i wan't to catch myException unmanaged
class , how do i do this ?

Thanks.

Nov 17 '05 #1
2 2405
Your managed classes shouldn't allow to throw unmanaged exceptions.
They're going to crash if you let them propagate outside of the native
world. Your managed wrapper should catch every unamanged exception and
translate them each to managed exceptions.

try
{
unmanaged();
}
catch(...)
{
throw gcnew System::Excepti on("descr"); // using VC++ 2005 syntax
}

Tom

yaron wrote:
Hi,

How do i catch an unmanaged c++ exceptions ?
right now i can catch the System.Runtime. InteropServices .SEHException and
System.Exceptio n exceptions , but i wan't to catch myException unmanaged
class , how do i do this ?

Thanks.

Nov 17 '05 #2
Your managed classes shouldn't allow to throw unmanaged exceptions.
They're going to crash if you let them propagate outside of the native
world. Your managed wrapper should catch every unamanged exception and
translate them each to managed exceptions.

try
{
unmanaged();
}
catch(...)
{
throw gcnew System::Excepti on("descr"); // using VC++ 2005 syntax
}

Tom

yaron wrote:
Hi,

How do i catch an unmanaged c++ exceptions ?
right now i can catch the System.Runtime. InteropServices .SEHException and
System.Exceptio n exceptions , but i wan't to catch myException unmanaged
class , how do i do this ?

Thanks.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5982
by: yaron | last post by:
Hi, How do i catch an unmanaged c++ exceptions ? right now i can catch the System.Runtime.InteropServices.SEHException and System.Exception exceptions , but i wan't to catch myException unmanaged class , how do i do this ? Thanks.
12
6092
by: Vasco Lohrenscheit | last post by:
Hi, I have a Problem with unmanaged exception. In the debug build it works fine to catch unmanaged c++ exceptions from other dlls with //managed code: try { //the form loads unmanaged dlls out of which unmanaged exception //get thrown
0
244
by: yaron | last post by:
Hi, How do i catch an unmanaged c++ exceptions ? right now i can catch the System.Runtime.InteropServices.SEHException and System.Exception exceptions , but i wan't to catch myException unmanaged class , how do i do this ? Thanks.
3
1403
by: TheLetti | last post by:
Hello out there, is there any possibility for me to catch or avoid crashes caused within unmanaged code? The situation: I'm writing a managed wrapper in MC++, and in there I use some unmanaged COM methods for creating thumbnails. The problem: One special line may cause a crash, and subsequently
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.