First off, I'm a bit confused whether this is the last / most up-to-date version of this block.
But my issue building this on Win-10 using MSVC, was plainly this C++ exception (from CDB after generating rsp1.py
):
ModLoad: 5c790000 5c809000 f:\gv\dx-radio\gnuradio\gv-build\lib\site-packages\sdrplay3\sdrplay3_python.pyd
ModLoad: 5c970000 5c9b6000 f:\gv\dx-radio\gnuradio\gv-build\bin\gnuradio-sdrplay3.dll
ModLoad: 5ca00000 5ca0b000 f:\gv\dx-radio\gnuradio\gv-build\bin\sdrplay_api.dll
ModLoad: 74510000 745b3000 C:\WINDOWS\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9619_none_508d9c7abcbd32b6\MSVCR90.dll
(db0.d08): C++ EH exception - code e06d7363 (first chance)
(db0.d08): C++ EH exception - code e06d7363 (!!! second chance !!!)
eax=0084e278 ebx=0084e328 ecx=00000003 edx=00000000 esi=69f014a0 edi=5c9ab8dc
eip=769b46d2 esp=0084e278 ebp=0084e2d4 iopl=0 nv up ei pl nz ac pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00200216
KERNELBASE!RaiseException+0x62:
769b46d2 8b4c2454 mov ecx,dword ptr [esp+54h] ss:002b:0084e2cc=ea1bd2d3
At first (when running w/o the debugger), I thought it had something to do with mixing CRTs; MSVCR90.dll
in SDRPLAY_API.dll
and vcruntime140.dll
in my Python 3.6. But no. The ugly call-stack (deep inside a Python-call) shows it:
....
(Inline) -------- gnuradio_sdrplay3!std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,
gr::sdrplay3::_antenna,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,gr::sdrplay3::_antenna> > >::{ctor}+0x4a
0084e480 75fb9b77 gnuradio_sdrplay3!gr::sdrplay3::`dynamic initializer for 'antennas''(void)+0x19f
Since you had 3 equally named struct _antenna
, I renamed them to become unique (struct _antenna_rsp1
, etc.).
That seemed to have fixed it. No crash from MSVC's STL-code. I have a RSP1A which works fine.
Edit: my patch:
--- a/rsp2_impl.cc 2020-12-18 11:27:05
+++ b/rsp2_impl.cc 2020-12-18 15:10:34
@@ -33,12 +33,12 @@
// Antenna methods
-struct _antenna {
+struct _antenna_rsp2 {
sdrplay_api_Rsp2_AntennaSelectT select;
bool high_z;
};
-static const std::map<std::string, struct _antenna> antennas = {
+static const std::map<std::string, struct _antenna_rsp2> antennas = {
{ "Antenna A", { sdrplay_api_Rsp2_ANTENNA_A, false } },
{ "Antenna B", { sdrplay_api_Rsp2_ANTENNA_B, false } },
{ "Hi-Z", { sdrplay_api_Rsp2_ANTENNA_A, true } }
--- a/rspduo_impl.cc 2020-12-18 11:27:05
+++ b/rspduo_impl.cc 2020-12-18 15:09:55
@@ -107,12 +107,12 @@
// Antenna methods
-struct _antenna {
+struct _antenna_duo {
sdrplay_api_TunerSelectT tuner;
bool high_z;
};
-static const std::map<std::string, struct _antenna> antennas = {
+static const std::map<std::string, struct _antenna_duo> antennas = {
{ "Tuner 1 50 ohm", { sdrplay_api_Tuner_A, false } },
{ "Tuner 2 50 ohm", { sdrplay_api_Tuner_B, false } },
{ "High Z", { sdrplay_api_Tuner_A, true } },
--- a/rspdx_impl.cc 2020-12-18 11:27:05
+++ b/rspdx_impl.cc 2020-12-18 15:10:15
@@ -33,11 +33,11 @@
// Antenna methods
-struct _antenna {
+struct _antenna_dx1 {
sdrplay_api_RspDx_AntennaSelectT select;
};
-static const std::map<std::string, struct _antenna> antennas = {
+static const std::map<std::string, struct _antenna_dx1> antennas = {
{ "Antenna A", { sdrplay_api_RspDx_ANTENNA_A } },
{ "Antenna B", { sdrplay_api_RspDx_ANTENNA_B } },
{ "Antenna C", { sdrplay_api_RspDx_ANTENNA_C } }