DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Bruce Richardson <bruce.richardson@intel.com>,
	David Marchand <david.marchand@redhat.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH 3/3] ethdev: import and export data variables for MSVC
Date: Tue, 12 Mar 2024 00:51:48 -0700	[thread overview]
Message-ID: <1710229908-31704-4-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1710229908-31704-1-git-send-email-roretzla@linux.microsoft.com>

MSVC requires that data variables be explicitly declared as either
imported or exported. Provide macros that allow dpdk to correctly
declare data variables as exported for itself and imported for
applications.

Use new per-library macro to declare variables exported or imported for
per-lcore data variables.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/ethdev/meson.build         |  1 +
 lib/ethdev/rte_ethdev_core.h   |  3 +++
 lib/ethdev/rte_ethdev_export.h | 23 +++++++++++++++++++++++
 lib/ethdev/version.map         |  2 +-
 4 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 lib/ethdev/rte_ethdev_export.h

diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build
index f1d2586..b270e02 100644
--- a/lib/ethdev/meson.build
+++ b/lib/ethdev/meson.build
@@ -23,6 +23,7 @@ sources = files(
 headers = files(
         'rte_cman.h',
         'rte_ethdev.h',
+        'rte_ethdev_export.h',
         'rte_ethdev_trace_fp.h',
         'rte_dev_info.h',
         'rte_flow.h',
diff --git a/lib/ethdev/rte_ethdev_core.h b/lib/ethdev/rte_ethdev_core.h
index e55fb42..4e7939f 100644
--- a/lib/ethdev/rte_ethdev_core.h
+++ b/lib/ethdev/rte_ethdev_core.h
@@ -16,6 +16,8 @@
  * Applications should not use these directly.
  */
 
+#include <rte_ethdev_export.h>
+
 struct rte_eth_dev_callback;
 /** @internal Structure to keep track of registered callbacks */
 RTE_TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
@@ -126,6 +128,7 @@ struct __rte_cache_aligned rte_eth_fp_ops {
 
 };
 
+__rte_ethdev_export
 extern struct rte_eth_fp_ops rte_eth_fp_ops[RTE_MAX_ETHPORTS];
 
 #endif /* _RTE_ETHDEV_CORE_H_ */
diff --git a/lib/ethdev/rte_ethdev_export.h b/lib/ethdev/rte_ethdev_export.h
new file mode 100644
index 0000000..7887bee
--- /dev/null
+++ b/lib/ethdev/rte_ethdev_export.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Microsoft Corporation
+ */
+
+#ifndef _RTE_ETHDEV_EXPORT_H_
+#define _RTE_ETHDEV_EXPORT_H_
+
+/**
+ * @file
+ *
+ * Import / Export macros for ethdev data variables.
+ */
+
+#include <rte_common.h>
+
+#ifndef __rte_ethdev_export
+#define __rte_ethdev_export __rte_declare_import
+#else
+#undef __rte_ethdev_export
+#define __rte_ethdev_export __rte_declare_export
+#endif
+
+#endif
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 79f6f52..efe426f 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -83,7 +83,7 @@ DPDK_24 {
 	rte_eth_find_next_of;
 	rte_eth_find_next_owned_by;
 	rte_eth_find_next_sibling;
-	rte_eth_fp_ops;
+	rte_eth_fp_ops; # MSVC_NO_EXPORT
 	rte_eth_iterator_cleanup;
 	rte_eth_iterator_init;
 	rte_eth_iterator_next;
-- 
1.8.3.1


      parent reply	other threads:[~2024-03-12  7:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  7:51 [PATCH 0/3] RFC fix import/export MSVC data variables Tyler Retzlaff
2024-03-12  7:51 ` [PATCH 1/3] buildtools: ignore exports for MSVC Tyler Retzlaff
2024-03-12  7:51 ` [PATCH 2/3] eal: import and export data variables " Tyler Retzlaff
2024-03-12  7:51 ` Tyler Retzlaff [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1710229908-31704-4-git-send-email-roretzla@linux.microsoft.com \
    --to=roretzla@linux.microsoft.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).