Support MSVC and MinGW SDK consumers

Compared with dc08a95:

- Add explicit module-definition files for the capture and preview DLLs so their public C export names remain stable and can be consumed without compiler-specific C++ symbol conventions.

- Keep the SDK implementation built with MSVC while automatically using MinGW dlltool to generate libgvfg.dll.a and libgvfg_preview.dll.a alongside the existing MSVC import libraries.

- Make the public capture header portable by including SAL only under MSVC and defining no-op annotations required by non-MSVC C and C++ compilers.

- Replace the Qt sample's compiler-specific wait on std::thread::native_handle() with an explicit atomic worker-completion state while preserving synchronous window-message servicing during shutdown.

- Document that MSVC and MinGW consumers use different import libraries while loading the same gvfg.dll and gvfg_preview.dll at runtime.

Validation: MSVC Debug and Release SDK builds passed and produced both MSVC and MinGW import libraries. Qt MSVC Debug, Qt MinGW Debug, and Qt MinGW Release sample builds and links passed. MinGW C and C++ public-header syntax checks passed, the MinGW executable import table references the expected GVFG DLLs and C exports, and git diff --check passed. No runtime launch, capture, audio playback, clean-machine deployment, or hardware validation was run.
This commit is contained in:
Mark.lin
2026-09-11 14:52:24 +08:00
parent dc08a953fa
commit 1214e720d2
9 changed files with 133 additions and 2 deletions
+3 -1
View File
@@ -610,6 +610,7 @@ void MainWindow::startCapture(int channelIndex)
std::memory_order_release);
channel.stopRequested.store(false, std::memory_order_release);
channel.running.store(true, std::memory_order_release);
channel.captureThreadExited.store(false, std::memory_order_release);
channel.captureThread = std::thread([this, channelIndex]()
{ captureReadLoop(channelIndex); });
if (audioEnabled)
@@ -1355,6 +1356,7 @@ void MainWindow::captureReadLoop(int channelIndex)
{ showError(QStringLiteral("gvfg_read_channel_frame"), st, channelIndex); }, Qt::QueuedConnection);
break;
}
channel.captureThreadExited.store(true, std::memory_order_release);
}
void MainWindow::joinCaptureThread(int channel)
@@ -1363,7 +1365,7 @@ void MainWindow::joinCaptureThread(int channel)
{
// The capture worker can wait behind preview resource updates. Keep
// DXGI's synchronous HWND messages flowing while joining it.
while (WaitForSingleObject(channels_[channel].captureThread.native_handle(), 0) == WAIT_TIMEOUT)
while (!channels_[channel].captureThreadExited.load(std::memory_order_acquire))
{
MsgWaitForMultipleObjectsEx(0, nullptr, 1, QS_SENDMESSAGE, MWMO_INPUTAVAILABLE);
MSG message{};