Exceptions in native dll's?

  • Thread starter Thread starter ORC
  • Start date Start date
O

ORC

How to catch exceptions that happens in a native DLL? I have an application
that calls a function in a native dll but even though the dll call is in a
try statement it doesn't get catched - the exception is thrown outside my
application and my application is closed by the system????. A specific
example is if the native dll tries to open a file that isn't there. - Any
suggestion?

Thanks,
Ole
 
If this is your own DLL - add exception handling there. Otherwise either
write your managed code so that it does not throw unmanaged exceptions, or
wrap unmanaged DLL into another unmanaged DLL that has exception handling.
Managed exceptin handlers cannot catch unmanaged execptions
 
OK- thanks Alex.

Ole

Alex Feinman said:
If this is your own DLL - add exception handling there. Otherwise either
write your managed code so that it does not throw unmanaged exceptions, or
wrap unmanaged DLL into another unmanaged DLL that has exception handling.
Managed exceptin handlers cannot catch unmanaged execptions
 
Back
Top