[PATCH] rte_dev: allow C-symbol-in-C++ dma operations

Tianhao Chai cth451 at gmail.com
Thu May 5 06:39:35 CEST 2022


Currently the "extern C" section ends right before rte_dev_dma_unmap
and other DMA function declarations, causing some C++ compilers to
produce C++ mangled symbols to rte_dev_dma_unmap instead of C symbols.
This leads to build failures later when linking a final executable
against this object.

The issue is observed on DPDK 22.03 and G++ 11.

Signed-off-by: Tianhao Chai <cth451 at gmail.com>
---
 lib/eal/include/rte_dev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 448a41cb0e..e6ff1218f9 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -320,10 +320,6 @@ rte_dev_iterator_next(struct rte_dev_iterator *it);
 	     dev != NULL; \
 	     dev = rte_dev_iterator_next(it))
 
-#ifdef __cplusplus
-}
-#endif
-
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice
@@ -496,4 +492,8 @@ int
 rte_dev_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova,
 		  size_t len);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_DEV_H_ */
-- 
2.35.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://mails.dpdk.org/archives/dev/attachments/20220504/d5cbbe60/attachment-0001.sig>


More information about the dev mailing list