From b01914aa3cdc1232ccbf8be2e8612e55afaedb12 Mon Sep 17 00:00:00 2001 From: George Baltz N3GB Date: Mon, 9 Feb 2026 13:48:41 -0500 Subject: [PATCH] Mark some data as private and not safe for applications The pointers may move, or the method to get the address may change. --- bindings/ignore.swg | 7 +++++++ include/hamlib/rig.h | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/bindings/ignore.swg b/bindings/ignore.swg index 20aee262e..ad288fe23 100644 --- a/bindings/ignore.swg +++ b/bindings/ignore.swg @@ -115,6 +115,13 @@ %ignore PRIfreq; %ignore SCNfreq; +// Private HAMLIB data +%ignore cache_addr; +%ignore rigport_addr; +%ignore pttport_addr; +%ignore dcdport_addr; +%ignore state_addr; + // others %rename("$ignore", regexmatch$name="python_callbacks") ""; // internal structs and methods used by bindings %ignore rig_state::cache; // deprecated diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index bd5850f9c..e6c425289 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -98,6 +98,14 @@ #define HL_DEPRECATED #endif +// Macro to mark function or variable as private to HAMLIB +// and unsafe for application use +#if __has_c_attribute(deprecated) && !defined(IN_HAMLIB) +#define HL_PRIVATE [[deprecated("HAMLIB private data")]] +#else +#define HL_PRIVATE +#endif + /** * \addtogroup rig * @{ @@ -2675,10 +2683,15 @@ struct s_rig { /* Data after this line is for hamlib internal use only, * and should *NOT* be referenced by applications, as layout will change! */ + HL_PRIVATE struct rig_cache *cache_addr; /*!< address of rig_cache buffer */ + HL_PRIVATE hamlib_port_t *rigport_addr; /*!< address of rig control (CAT) port struct */ + HL_PRIVATE hamlib_port_t *pttport_addr; /*!< address of PTT control port struct */ + HL_PRIVATE hamlib_port_t *dcdport_addr; /*!< address of DCD control port struct */ + HL_PRIVATE struct rig_state *state_addr; /*!< address of rig_state struct */ };