Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I just tried to use C++ exceptions in one of my userland applications and I have a little problem...
First of all a few words about the environment. I'm using my default linux GCC and G++ to compile all executables of my OS. The command line parameters for the compiler are the following:
I'm not using -fno-exceptions or -no-rtti anywhere. I've a previously created libstdc++.a that runs on my OS and I'm linking this file statically with the C++ executables that runs on my OS.
I just created a little application and I called a function that throws an exception. I'm sure that the exception is thrown because the application exits in the middle of the execution. The funny thing is that the call to the function that throws the exception is surrounded with a try { } catch ( ... ) { print() } block.
I'd like to ask some help in finding out why the exception handler catch is not reached and the exception is handled like a non-caught exception?
I think that the stack unwinding is provided by the libraries that comes from the GCC such as libstdc++.a and libgcc+a.
As i didn't wrote any unwinding stuff and i didn't get any undefined symbol at linking i think these are implemented in the above mentioned libraries
That your linker doesn't complain seems to indicate you indeed linked the appropriate library parts.
But - and I ask this being ignorant of virtually all the details of C++ environment initialization - do you execute all required set-up steps when loading your executable?
Every good solution is obvious once you've found it.