Throwing an exception on Android causes Segmentation Fault 11 error before catch handler is called

  

I am developing my first multi-platform application with C++Builder 10.3.3. My first two targets will be Android and Windows.

I have run into an issue with even the most simplest Android apps when I try to use any exception handling.

The following code in ANY function causes a “Segmentation fault (11)” error. I have tried it on a Huawei Mate 8 Pro running Android 7, and on a Samsung Note 9 running Android 9.

void __fastcall Function(void)
{
try
{
throw Exception(_D(“This is a test exception!”));
}
catch (const Exception & objException)
{
if (objException.Message.IsEmpty() == false)
{
}
}
}

The exception gets created and thrown, but the Segmentation Fault gets raised and my catch handler is never reached.

How do I fix this?

Comments are closed.