Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hamlib issue in 'samplemimo/audiocatsiso/audiocatsisohamlib.cpp ' #1919

Closed
gvanem opened this issue Dec 10, 2023 · 0 comments
Closed

Hamlib issue in 'samplemimo/audiocatsiso/audiocatsisohamlib.cpp ' #1919

gvanem opened this issue Dec 10, 2023 · 0 comments

Comments

@gvanem
Copy link

gvanem commented Dec 10, 2023

A recent commit in Hamlib, broke the compilation of plugins/samplemimo/audiocatsiso/audiocatsisohamlib.cpp:

AudioCatsIsoHamlib.cpp(24): error C2664: 'int rig_list_foreach(int (__cdecl *)(rig_caps *,void *),void *)': 
cannot convert argument 1 from 'int (__cdecl *)(const rig_caps *,void *)' to 'int (__cdecl *)(rig_caps *,void *)'
AudioCatsIsoHamlib.cpp(24): note: None of the functions with this name in scope match the target type
f:\gv\dx-radio\HamLib\include\hamlib/rig.h(3694): note: see declaration of 'rig_list_foreach'
AudioCatsIsoHamlib.cpp(24): note: while trying to match the argument list '(overloaded-function, AudioCATSISOHamlib *)'

But now Hamlib has also a #define RIGCAPS_NOT_CONST to test for.

This is how I hacked around this issue:

--- a/audiocatsisohamlib.h 2023-12-10 11:49:04
+++ b/audiocatsisohamlib.h 2023-12-10 12:05:06
@@ -21,8 +21,19 @@
 #define _AUDIOCATSISO_AUDIOCATSISOHAMLIB_H_

 #include <QMap>
+#include <hamlib/rig.h>

-struct rig_caps;
+#ifdef RIGCAPS_NOT_CONST
+
+  /* Since this commit:
+   *   https://github.com/Hamlib/Hamlib/commit/ed941939359da9f8734dbdf4a21a9b01622a1a6e
+   * a 'struct rig_caps' is no longer constant (as passed to 'rig_list_foreach()' etc.).
+   */
+
+  #define HAMLIB_RIG_CAPS struct rig_caps
+#else
+  #define HAMLIB_RIG_CAPS const struct rig_caps
+#endif

 class AudioCATSISOHamlib
 {
@@ -36,7 +47,7 @@
 private:
     QMap<uint32_t, QString> m_rigModels;
     QMap<QString, uint32_t> m_rigNames;
-    static int hash_model_list(const struct rig_caps *caps, void *data);
+    static int hash_model_list(HAMLIB_RIG_CAPS *caps, void *data);
 };

--- a/audiocatsisohamlib.cpp 2023-12-10 11:49:04
+++ b/audiocatsisohamlib.cpp 2023-12-10 12:03:32
@@ -17,7 +17,6 @@
 // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 ///////////////////////////////////////////////////////////////////////////////////

-#include <hamlib/rig.h>
 #include "audiocatsisohamlib.h"

 AudioCATSISOHamlib::AudioCATSISOHamlib()
@@ -31,7 +30,7 @@
 {
 }

-int AudioCATSISOHamlib::hash_model_list(const struct rig_caps *caps, void *data)
+int AudioCATSISOHamlib::hash_model_list(HAMLIB_RIG_CAPS *caps, void *data)
 {
     AudioCATSISOHamlib *hamlibHandler = (AudioCATSISOHamlib*) data;
     hamlibHandler->m_rigModels[caps->rig_model] = caps->model_name;

I'm on Win-10 using MSVC (x64).

@f4exb f4exb closed this as completed in bb406ca Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant