[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 0058cffcc7255ba855bc7
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-01-21 23:20:14
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via 0058cffcc7255ba855bc75129c9ece878e0b829d (commit) from 39e4aad778699793e7a4136552e28e11e7a2f3ec (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0058cffcc7255ba855bc75129c9ece878e0b829d Author: Michael Black W9MDB <mdb...@ya...> Date: Thu Jan 21 17:18:45 2021 -0600 Add rig_check_rig_caps to check that shared library compatibility is good Returns -RIG_EINTERNAL if bad, RIG_OK if good Prints out WARN level message if bad diff --git a/src/rig.c b/src/rig.c index 228e4957..bc451e14 100644 --- a/src/rig.c +++ b/src/rig.c @@ -88,6 +88,8 @@ const char hamlib_version[21] = "Hamlib " PACKAGE_VERSION; const char *hamlib_version2 = "Hamlib " PACKAGE_VERSION; //! @endcond +struct rig_caps caps_test; + /** * \brief Hamlib copyright notice */ @@ -301,6 +303,37 @@ const char *HAMLIB_API rigerror(int errnum) return rigerror_table[errnum]; } +// We use a couple of defined pointer to determine if the shared library changes +void *caps_test_rig_model = &caps_test.rig_model; +void *caps_test_macro_name = &caps_test.macro_name; + +// check and show WARN if rig_caps structure doesn't match +// this tests for shared library incompatibility +int rig_check_rig_caps() +{ + int rc = RIG_OK; + + if (&caps_test.rig_model != caps_test_rig_model) + { + rc = -RIG_EINTERNAL; + rig_debug(RIG_DEBUG_WARN, "%s: shared libary change#1\n", __func__); + } + + if (&caps_test.macro_name != caps_test_macro_name) + { + rc = -RIG_EINTERNAL; + rig_debug(RIG_DEBUG_WARN, "%s: shared libary change#2\n", __func__); + } + + if (rc != RIG_OK) + { + rig_debug(RIG_DEBUG_TRACE, "%s: p1=%p, p2=%p, rig_model=%p, macro_name=%p\n", + __func__, caps_test_rig_model, caps_test_macro_name, &caps_test.rig_model, + &caps_test.macro_name); + } + + return rc; +} /** * \brief allocate a new RIG handle @@ -323,6 +356,8 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model) ENTERFUNC; + rig_check_rig_caps(); + rig_check_backend(rig_model); caps = rig_get_caps(rig_model); ----------------------------------------------------------------------- Summary of changes: src/rig.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) hooks/post-receive -- Hamlib -- Ham radio control libraries |