diff options
author | Stanislav Fomichev <sdf@google.com> | 2018-11-21 09:29:44 -0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-11-21 23:15:41 +0100 |
commit | 8c4905b995c649ac71e21611abc2fcefc904b56a (patch) | |
tree | 8f81fc53ebbdf9a0c08cd0b6b9b16d5a19d33655 /tools/lib/bpf/btf.h | |
parent | 462c124c590fe633564192dbfa26e99af788a67c (diff) | |
download | linux-8c4905b995c649ac71e21611abc2fcefc904b56a.tar.gz |
libbpf: make sure bpf headers are c++ include-able
Wrap headers in extern "C", to turn off C++ mangling.
This simplifies including libbpf in c++ and linking against it.
v2 changes:
* do the same for btf.h
v3 changes:
* test_libbpf.cpp to test for possible future c++ breakages
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/lib/bpf/btf.h')
-rw-r--r-- | tools/lib/bpf/btf.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index 386b2ffc32a3..701ad2b6c41f 100644 --- a/tools/lib/bpf/btf.h +++ b/tools/lib/bpf/btf.h @@ -6,6 +6,10 @@ #include <linux/types.h> +#ifdef __cplusplus +extern "C" { +#endif + #ifndef LIBBPF_API #define LIBBPF_API __attribute__((visibility("default"))) #endif @@ -80,4 +84,8 @@ int btf_ext__reloc(struct btf *btf, struct btf_ext *btf_ext, const char *sec_name, __u32 insns_cnt, void **func_info, __u32 *func_info_len); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* __LIBBPF_BTF_H */ |