Skip to content

Commit 14b0f18

Browse files
committed
Make AtomicsShims compatible with C++ interop
This fixes linker errors such as ``` Undefined symbols for architecture arm64: "_sa_retain_n(void*, unsigned int)", referenced from: (extension in Atomics):Swift.Unmanaged.retain(by: Swift.Int) -> () in Unmanaged extensions.swift.o NOTE: found '__sa_retain_n' in _AtomicsShims.c.o, declaration possibly missing 'extern "C"' ``` when building with Swift/C++ interoperability enabled.
1 parent d61ca10 commit 14b0f18

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/_AtomicsShims/include/_AtomicsShims.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434
# define SWIFTATOMIC_SHIMS_EXPORT
3535
# endif
3636
#else
37-
# define SWIFTATOMIC_SHIMS_EXPORT extern
37+
# ifdef __cplusplus
38+
# define SWIFTATOMIC_SHIMS_EXPORT extern "C"
39+
# else
40+
# define SWIFTATOMIC_SHIMS_EXPORT extern
41+
# endif
3842
#endif
3943

4044
// Swift-importable shims for C atomics.

0 commit comments

Comments
 (0)