Link Winsock after uasync and include socket headers first

This commit is contained in:
evgeny committed 2026-10-06 15:11:16 +02:00
1 parent e9e38ee029
commit c81e8e5025
2 files changed
+13 -4

No files matched your search

+6 -1
View File
@@ -66,6 +66,11 @@ set_target_properties(opus_internal PROPERTIES
target_link_libraries(uasync PUBLIC opus_internal)
# WinSock вызывается в uasync (DNS/сокеты/event loop); импортная библиотека нужна после её архива.
if(WIN32)
target_link_libraries(uasync PUBLIC ws2_32)
endif()
target_compile_definitions(uasync PRIVATE
_ISOC99_SOURCE
DEBUG_OUTPUT_STDERR
@@ -156,5 +161,5 @@ target_link_libraries(utun PUBLIC
# Platform-specific link flags
if(WIN32)
target_link_libraries(utun PUBLIC ws2_32 iphlpapi advapi32 bcrypt dbghelp)
target_link_libraries(utun PUBLIC iphlpapi advapi32 bcrypt dbghelp)
endif()
+7 -3
View File
@@ -1,3 +1,6 @@
#ifdef _WIN32
#include <winsock2.h>
#endif
#include <QCoreApplication>
#include <QApplication>
#include <QIcon>
@@ -39,9 +42,10 @@ static DWORD count_threads(void) {
static BOOL WINAPI console_ctrl_handler(DWORD dwCtrlType) {
if (dwCtrlType == CTRL_C_EVENT || dwCtrlType == CTRL_BREAK_EVENT) {
if (g_mainWindow)
QMetaObject::invokeMethod(g_mainWindow, [g_mainWindow] {
g_mainWindow->requestShutdown();
MainWindow* window = g_mainWindow;
if (window)
QMetaObject::invokeMethod(window, [window] {
window->requestShutdown();
}, Qt::QueuedConnection);
else if (g_ctrl_node)
g_ctrl_node->requestStop();