diff mbox series

kernel-shark-2.alpha: Force trace-cmd.h to be used as plain C

Message ID 20200409142511.82228-1-tz.stoyanov@gmail.com (mailing list archive)
State Superseded
Headers show
Series kernel-shark-2.alpha: Force trace-cmd.h to be used as plain C | expand

Commit Message

Tzvetomir Stoyanov (VMware) April 9, 2020, 2:25 p.m. UTC
From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>

C++ compiler uses name mangling to handle function overloading. As there is no function overloading in C, function names are not mangled. This breaks the linking of C library into C++ binary.
Declare functions from trace-cmd.h as pure C, so the loader will not mangle the names when resolving them.

Signed-off-by: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
---
 src/plugins/KVMCombo.cpp | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/src/plugins/KVMCombo.cpp b/src/plugins/KVMCombo.cpp
index 3ff9ca5..1ae03aa 100644
--- a/src/plugins/KVMCombo.cpp
+++ b/src/plugins/KVMCombo.cpp
@@ -13,7 +13,9 @@ 
 #include<iostream>
 
 // trace-cmd
+extern "C" {
 #include "trace-cmd/trace-cmd.h"
+}
 
 // KernelShark
 #include "libkshark.h"