Re: [PATCH v3 4/5] kernel-shark-2.alpha: Force trace-cmd.h to be used as plain C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 16.04.20 г. 19:00 ч., Tzvetomir Stoyanov (VMware) wrote:
From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@xxxxxxxxx>

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@xxxxxxxxx>
---
  src/plugins/KVMCombo.cpp | 2 ++
  1 file changed, 2 insertions(+)

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"
+}

I think we do not need to include trace-cmd.h at all.
Thanks,
Yordan


  // KernelShark
  #include "libkshark.h"




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux