Make use of Win32 functions conditional on _WIN32, not _MSC_VER.
Using _MSC_VER here means that the choice of signal() versus SetConsoleCtrlHandler depends on the compiler being used, rather than the OS being targeted. When built with MinGW rather than MSVC, this happens to work because MinGW's signal emulation is used, but that emulation is quite limited. Instead, be consistent and use the Win32 API when building for that platform, regardless of compiler. Note that if building for Cygwin, _WIN32 is not defined and POSIX APIs are used.
This commit is contained in:
@ -609,7 +609,7 @@ static void usage()
|
||||
|
||||
static hackrf_device* device = NULL;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
BOOL WINAPI sighandler(int signum)
|
||||
{
|
||||
if (CTRL_C_EVENT == signum) {
|
||||
@ -1041,7 +1041,7 @@ int main(int argc, char** argv)
|
||||
fwrite(&wave_file_hdr, 1, sizeof(t_wav_file_hdr), file);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
SetConsoleCtrlHandler((PHANDLER_ROUTINE) sighandler, TRUE);
|
||||
#else
|
||||
signal(SIGINT, &sigint_callback_handler);
|
||||
|
Reference in New Issue
Block a user