Subject: Proposal for Prototype Implementation to Enhance C/C++ Interoperability in PostgreSQL

From: "盏一" <[email-masked]>
Date: Sun, 7 May 2023 14:48:14 +0800

Hi

I am writing to propose a prototype implementation that can greatly enhance the C/C++ interoperability in PostgreSQL. The implementation involves converting PG longjmp to&nbsp;[force unwind](https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html#base-throw), which triggers the destruction of local variables on the stack. Additionally, it converts throw statements that are not associated with catch to PG longjmp, thereby avoiding the call to terminate.

The proposed implementation can significantly improve the interoperability between C and C++ code in PostgreSQL. It allows for seamless integration of C++ code with PostgreSQL, without the need for complex workarounds or modifications to the existing codebase.

I have submitted the implementation on&nbsp;[GitHub](https://github.com/postgres/postgres/commit/1a9a2790430f256d9d0cc371249e43769d93eb8e#diff-6b6034caa00ddf38f641cbd10d5a5d1bb7135f8b23c5a879e9703bd11bd8240f). I would appreciate it if you could review the implementation and provide feedback.

Thank you for your time and consideration.

Best regards,

盏一
----------