[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Openexr-devel] Exceptions in the DLL
From: |
Florian Kainz |
Subject: |
Re: [Openexr-devel] Exceptions in the DLL |
Date: |
Mon, 22 Nov 2004 10:29:05 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314 |
I tried to make exrdisplay on Windows XP display a non-EXR file, and
I got an error message that says something like "File is not an image
file." This means that an exception derived from std::exception was
thrown in the constructor for class Imf::InputFile and caught in main().
As long as no DLLs are involved, the throw/catch mechanism appears
to work.
When you compile an IlmImf DLL, function ImfOpenInputFile() becomes
part of the DLL. The function catches all exceptions derived from
std::exception, just like exrdisplay's main(). When an exception
is caught, its what() string is stored in a static variable and
ImfOpenInputFile() returns 0. The function seems to conform to
Herb Sutter's guidelines.
To test if you are dealing with an unusual exception that is not derived
from std::exception, you may want to try changing ImfOpenInputFile() so
that it looks like this:
ImfInputFile *
ImfOpenInputFile (const char name[])
{
try
{
return (ImfInputFile *) new Imf::RgbaInputFile (name);
}
catch (const std::exception &e)
{
setErrorMessage (e);
return 0;
}
catch (...)
{
strcpy (errorMessage, "Unexpected exception");
return 0;
}
}
Florian
- [Openexr-devel] Exceptions in the DLL, Paul Nolan, 2004/11/21
- Re: [Openexr-devel] Exceptions in the DLL, Paul Schneider, 2004/11/21
- Re: [Openexr-devel] Exceptions in the DLL, Paul Nolan, 2004/11/21
- Re: [Openexr-devel] Exceptions in the DLL, Paul Schneider, 2004/11/21
- Re: [Openexr-devel] Exceptions in the DLL, Paul Nolan, 2004/11/22
- [Openexr-devel] Mac Shake 3.5 plugin download testing, Paul Schneider, 2004/11/29
- [Openexr-devel] OpenEXR QT/CORE Support, Derek Gerstmann, 2004/11/29
- Re: [Openexr-devel] OpenEXR QT/CORE Support, Drew Hess, 2004/11/29
- Re: [Openexr-devel] Exceptions in the DLL,
Florian Kainz <=