Skip to content

Commit 43e4c3c

Browse files
authored
Make CNIOBoringSSLShims compatible with C++ interop (#538)
This fixes linker errors such as ``` "CNIOBoringSSLShims_SSL_CTX_get_app_data(CNIOBoringSSL_ssl_ctx_st const*)", referenced from: static NIOSSL.NIOSSLContext.(lookupFromRawContext in <...>)(ssl: Swift.OpaquePointer) -> NIOSSL.NIOSSLContext in SSLContext.swift.o ``` when building with Swift/C++ interoperability enabled. This is similar to apple/swift-nio#3251.
1 parent 4b38f35 commit 43e4c3c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/CNIOBoringSSLShims/include/CNIOBoringSSLShims.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#include "CNIOBoringSSL.h"
2323
#endif
2424

25+
#if defined(__cplusplus)
26+
extern "C" {
27+
#endif
28+
2529
X509_EXTENSION *CNIOBoringSSLShims_sk_X509_EXTENSION_value(const STACK_OF(X509_EXTENSION) *sk, size_t i);
2630
size_t CNIOBoringSSLShims_sk_X509_EXTENSION_num(const STACK_OF(X509_EXTENSION) *sk);
2731

@@ -34,4 +38,8 @@ int CNIOBoringSSLShims_SSL_CTX_set_app_data(SSL_CTX *ctx, void *data);
3438
int CNIOBoringSSLShims_ERR_GET_LIB(uint32_t err);
3539
int CNIOBoringSSLShims_ERR_GET_REASON(uint32_t err);
3640

41+
#if defined(__cplusplus)
42+
} // extern "C"
43+
#endif
44+
3745
#endif // C_NIO_BORINGSSL_SHIMS_H

0 commit comments

Comments
 (0)