File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
documentation/cxx-interop/status Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,27 @@ building C++ code for Ubuntu.
87
87
Mixed Swift and C++ code must use
88
88
the same C++ standard library.
89
89
90
+ Using C++ interoperability requires a compiler with enabled support for the
91
+ C++14 standard or a newer version. Swift allows you to change which version of
92
+ the C++ standard it uses; however, the C++ library headers used from Swift must
93
+ also conform to the selected C++ standard. When using bidirectional
94
+ interoperability, programs need to be compiled with C++14 support, since the
95
+ generated C++ interface for a Swift module uses C++14 features.
96
+
97
+ #### Customizing the C++ Standard Version
98
+
99
+ Here's how to set the version of the C++ standard used for interoperability
100
+ by the Swift compiler:
101
+
102
+ - When compiling package dependencies, the C++ standard version can be
103
+ customized in ` Package.swift ` using the ` cxxLanguageStandard ` parameter in
104
+ your ` Package(...) ` .
105
+ - For Xcode targets, you can choose the C++ standard used from the C++ Language
106
+ Dialect setting in the Build Settings tab.
107
+ - If you're using a different build system or invoking the ` swiftc ` Swift
108
+ compiler directly from the command line, you can specify a C++ standard
109
+ version with the ` -Xcc -std= ` option, for example, ` -Xcc -std=c++20 ` .
110
+
90
111
## Supported C++ APIs
91
112
92
113
This section describes which C++ APIs are supported in Swift.
You can’t perform that action at this time.
0 commit comments