ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
c_cpp_compatibility.h File Reference

Fix gettext macro conflicts between PostgreSQL and the C++ STL. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Detailed Description

Fix gettext macro conflicts between PostgreSQL and the C++ STL.

When PostgreSQL is built without --enable-nls, its headers redefine gettext, ngettext, dgettext, and dngettext as no-op macros. Several STL and Boost headers later include <libintl.h>, which tries to declare the real function prototypes for those same names. The resulting macro/declaration clash causes compilation errors.

This header must be included in every translation unit that mixes PostgreSQL C headers with C++ STL or Boost headers. It undefines the four offending macros after the PostgreSQL headers have been processed, allowing libintl.h to declare the functions correctly.

The cleanest long-term fix is to build PostgreSQL with --enable-nls, but that is not always under the extension author's control.

Definition in file c_cpp_compatibility.h.