version.hxx.template 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Version info for libpqxx.
  2. *
  3. * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/version instead.
  4. *
  5. * Copyright (c) 2000-2022, Jeroen T. Vermeulen.
  6. *
  7. * See COPYING for copyright license. If you did not receive a file called
  8. * COPYING with this source code, please notify the distributor of this
  9. * mistake, or contact the author.
  10. */
  11. #ifndef PQXX_H_VERSION
  12. #if !defined(PQXX_HEADER_PRE)
  13. #error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
  14. #endif
  15. /// Full libpqxx version string.
  16. # define PQXX_VERSION "@PQXXVERSION@"
  17. /// Library ABI version.
  18. # define PQXX_ABI "@PQXX_ABI@"
  19. /// Major version number.
  20. # define PQXX_VERSION_MAJOR @PQXX_MAJOR@
  21. /// Minor version number.
  22. # define PQXX_VERSION_MINOR @PQXX_MINOR@
  23. # define PQXX_VERSION_CHECK check_pqxx_version_@PQXX_MAJOR@_@PQXX_MINOR@
  24. namespace pqxx::internal
  25. {
  26. /// Library version check stub.
  27. /** Helps detect version mismatches between libpqxx headers and the libpqxx
  28. * library binary.
  29. *
  30. * Sometimes users run into trouble linking their code against libpqxx because
  31. * they build their own libpqxx, but the system also has a different version
  32. * installed. The declarations in the headers against which they compile their
  33. * code will differ from the ones used to build the libpqxx version they're
  34. * using, leading to confusing link errors. The solution is to generate a link
  35. * error when the libpqxx binary is not the same version as the libpqxx headers
  36. * used to compile the code.
  37. *
  38. * This function's definition is in the libpqxx binary, so it's based on the
  39. * version as found in the binary. The headers contain a call to the function,
  40. * whose name contains the libpqxx version as found in the headers. (The
  41. * library build process will use its own local headers even if another version
  42. * of the headers is installed on the system.)
  43. *
  44. * If the libpqxx binary was compiled for a different version than the user's
  45. * code, linking will fail with an error: `check_pqxx_version_*_*` will not
  46. * exist for the given version number.
  47. */
  48. PQXX_LIBEXPORT int PQXX_VERSION_CHECK() noexcept;
  49. } // namespace pqxx::internal
  50. #endif