Build failure with dynamic library in C

I have a SwiftPM package which builds a little bit of C code to a dynamic library. It builds fine on Mac/Linux. On Windows (with Swift 5.5.1), I get:

C:\Users\eric\dev\sourcegear-bridge-lib-hook>swift build
[1/2] Compiling sg_resolve_jumptable sg_resolve_jumptable.c
lld-link: error: undefined symbol: __declspec(dllimport) swift_addNewDSOImage
>>> referenced by C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\x86_64\swiftrt.obj:(void __cdecl swift_image_constructor(void))
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[1/2] Linking C:\Users\eric\dev\sourcegear-bridge-lib-hook\.build\x86_64-unknown-windows-msvc\debug\sg_resolve_jumptable.dll

I could provide a minimal repro sample, but my actual case is nearly minimal already. The package is here:

My conjecture is that swiftrt.obj should not be added to the build when there is no Swift code in the package.

This is a known issue; it is a problem in the way that SPM handles linking libraries. Fixing this would require reworking how SPM handles linking libraries, to use the C/C++ driver appropriately to build the library rather than the Swift driver. See SR-14728.

Darn. Sorry, I should have been able to find that before posting it.

Thanks for the reply.