[dpdk-dev] [PATCH v2 3/3] mbuf_offload: fix header for C++

Thomas Monjalon thomas.monjalon at 6wind.com
Tue Feb 16 08:14:25 CET 2016


When built in a C++ application, the include fails for 2 reasons:

rte_mbuf_offload.h:128:24: error:
invalid conversion from ‘void*’ to ‘rte_pktmbuf_offload_pool_private*’ [-fpermissive]
    rte_mempool_get_priv(mpool);
                        ^
The cast must be explicit for C++.

rte_mbuf_offload.h:304:1: error: expected declaration before ‘}’ token

There was a closing brace for __cplusplus but not an opening one.

Fixes: 78c8709b5ddb ("mbuf_offload: introduce library to attach offloads to mbuf")

Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
 lib/librte_mbuf_offload/rte_mbuf_offload.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

v2:
- add struct keyword

diff --git a/lib/librte_mbuf_offload/rte_mbuf_offload.h b/lib/librte_mbuf_offload/rte_mbuf_offload.h
index 4345f06..77993b6 100644
--- a/lib/librte_mbuf_offload/rte_mbuf_offload.h
+++ b/lib/librte_mbuf_offload/rte_mbuf_offload.h
@@ -59,6 +59,9 @@
 #include <rte_mbuf.h>
 #include <rte_crypto.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /** packet mbuf offload operation types */
 enum rte_mbuf_ol_op_type {
@@ -125,7 +128,7 @@ static inline uint16_t
 __rte_pktmbuf_offload_priv_size(struct rte_mempool *mpool)
 {
 	struct rte_pktmbuf_offload_pool_private *priv =
-			rte_mempool_get_priv(mpool);
+		(struct rte_pktmbuf_offload_pool_private *)rte_mempool_get_priv(mpool);
 
 	return priv->offload_priv_size;
 }
-- 
2.7.0



More information about the dev mailing list