Skip to content

Commit

Permalink
quiche.h: move extern "C" below #includes in C API header
Browse files Browse the repository at this point in the history
This helps in using Quiche as a dependency in a Swift project.

Basically, the issue is that Swift does not support mixing C and C++ code when using interop, it has to use either C or C++, so if someone already has a C++ dependency in their project, Swift will try to import Quiche as Objective-C++, but this will cause issues due to #includes.

This technically is a shortcoming of Swift, not specifically an issue with Quiche, but the fix is very simple and shouldn't break anything for people using Quiche from C/C++/other languages with interop.
  • Loading branch information
adamwych authored Jun 26, 2024
1 parent 6eb0850 commit 8a5e9fc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions quiche/include/quiche.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
#ifndef QUICHE_H
#define QUICHE_H

#if defined(__cplusplus)
extern "C" {
#endif

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
Expand All @@ -52,6 +48,10 @@ extern "C" {
#define ssize_t SSIZE_T
#endif

#if defined(__cplusplus)
extern "C" {
#endif

// QUIC transport API.
//

Expand Down

0 comments on commit 8a5e9fc

Please sign in to comment.