From 5380463da248d8b2e7e34b39716b234f17305ab5 Mon Sep 17 00:00:00 2001
From: Giovanni La Mura <giovanni.lamura@inaf.it>
Date: Fri, 8 Mar 2024 16:40:19 +0100
Subject: [PATCH] Separate type function declaration from definition

---
 src/include/types.h   |  4 ++--
 src/libnptm/types.cpp | 13 +++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 src/libnptm/types.cpp

diff --git a/src/include/types.h b/src/include/types.h
index 148cf2e2..0271769a 100644
--- a/src/include/types.h
+++ b/src/include/types.h
@@ -17,12 +17,12 @@ typedef __complex__ double dcomplex;
  * \param z: `complex double` The argument of the function.
  * \return rz: `double` The real part of the argument.
  */
-double real(dcomplex z) { return __real__ z; }
+double real(dcomplex z);
 
 /*! \brief Get the imaginary part of a complex number.
  *
  * \param z: `complex double` The argument of the function.
  * \return iz: `double` The imaginary part of the argument.
  */
-double imag(dcomplex z) { return __imag__ z; }
+double imag(dcomplex z);
 #endif
diff --git a/src/libnptm/types.cpp b/src/libnptm/types.cpp
new file mode 100644
index 00000000..a9fd71be
--- /dev/null
+++ b/src/libnptm/types.cpp
@@ -0,0 +1,13 @@
+/* Distributed under the terms of GPLv3 or later. See COPYING for details. */
+
+/*! \file types.cpp
+ *
+ * \brief Implementation of the functions connected with types.
+ */
+#ifndef INCLUDE_TYPES_H_
+#include "../include/types.h"
+#endif
+
+double real(dcomplex z) { return __real__ z; }
+
+double imag(dcomplex z) { return __imag__ z; }
-- 
GitLab