Search code examples
c++exceptionabi

What ABI/C++runtime said when exception has happened in oher dynamic library?


Brief:

"Binary application" call another function from "dynamic library".

Is exception handling is the part of function ABI in reallife?

Detailed

Calling convention include something like:

  1. How parameters and to where parameters are pushed before function CALL
  2. What registers for parameters transfer and return code.
  3. Callee-save registers
  4. What registers are scratch and didn't need to saved
  5. What do with some unusual registers (ST*, XMM*)

But what will be if exceptions happend?

I'm more interesting in application and dynamic libraries written in C++ language and compiled via identical or with different toolchains.

Under exception I mean not ALU, niether MMU exception. It's just a program exception created via "throw" in C#/C++ or "raise" in python.


Solution

  • Yes, this is part of an ABI for C++. Otherwise an exception couldn't safely be thrown across boundaries between binaries.

    Here's an example: https://mentorembedded.github.io/cxx-abi/abi-eh.html