Cpp interop on windows not finding swift/bridging


I'm trying to make a cross platform app for Mac and Windows (and eventually Linux), using the new cxx-interop to call a 3rd party cpp library. I have this all working great on Mac (via SPM) and mostly working on Windows... but when I try to #include <swift/bridging> in my cpp code, I get a compile error on windows.

fatal error: 'swift/bridging' file not found

Where is that header located on non-mac platforms?


Unfortunately, reports like this are very useful but rarely encountered :frowning:

This header was missed in the 5.9 release cycles. I think that we should try to fix this for the next cycle. The fix for this is already in 5.10, and hopefully once we have official builds, that should be included. In the mean time, you can either try to build a release yourself. There is some work that The Browser Company is doing to get 5.10 builds going in the mean time, so that might become an option shortly while we are waiting on official builds.


Thanks for the info... I'm glad it's a known issue. Do you know the extent of the missing functionality? Is it just a matter of making a copy of the header in the project? That seems to still work on Mac, but on Windows I still fail compilation but in an actual compiler crash when trying to use the cpp object annotated with the swift bridging attributes (specifically SWIFT_SHARED_REFERENCE)


I’m only aware of the missing header. If there’s a crash, that’s new information. Do you have a reproduction that we can use? It would be good to check if this is still occurring on main and release/5.10.

Once we have information on the crash, we can look into what is needed and try to get it repaired.

I'll try to put together a simplified project that reproduces the crash over the holiday break.