[v5,2/8] eal: add header files to support windows

Message ID 20190326060238.9884-3-anand.rawat@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series HelloWorld example for windows |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Anand Rawat March 26, 2019, 6:02 a.m. UTC
  Added header files to support windows on x86 platforms.
Updated rte_common.h to include rte_windows.h for windows
build. Updated lib/meson.build to create shared libraries
on windows. Added def file to list the exports for the
eal library.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 lib/librte_eal/common/include/rte_common.h    |  7 ++++-
 .../common/include/rte_string_fns.h           |  4 ++-
 lib/librte_eal/rte_eal_exports.def            |  9 ++++++
 .../windows/eal/include/rte_windows.h         | 30 +++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  2 ++
 lib/meson.build                               | 19 ++++++++++--
 6 files changed, 66 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
  

Comments

Jerin Jacob Kollanukkaran March 26, 2019, 10:20 a.m. UTC | #1
On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> Added header files to support windows on x86 platforms.
> Updated rte_common.h to include rte_windows.h for windows
> build. Updated lib/meson.build to create shared libraries
> on windows. Added def file to list the exports for the
> eal library.
> 
> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> ---
>  lib/librte_eal/common/include/rte_common.h    |  7 ++++-
>  .../common/include/rte_string_fns.h           |  4 ++-
>  lib/librte_eal/rte_eal_exports.def            |  9 ++++++
>  .../windows/eal/include/rte_windows.h         | 30
> +++++++++++++++++++
>  lib/librte_eal/windows/eal/meson.build        |  2 ++
>  lib/meson.build                               | 19 ++++++++++--
>  6 files changed, 66 insertions(+), 5 deletions(-)
>  create mode 100644 lib/librte_eal/rte_eal_exports.def
>  create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
> 
> diff --git a/lib/librte_eal/common/include/rte_common.h
> b/lib/librte_eal/common/include/rte_common.h
> index 7178ba1e9..4775c84f5 100644
> --- a/lib/librte_eal/common/include/rte_common.h
> +++ b/lib/librte_eal/common/include/rte_common.h
> @@ -1,5 +1,5 @@
>  /* SPDX-License-Identifier: BSD-3-Clause
> - * Copyright(c) 2010-2014 Intel Corporation
> + * Copyright(c) 2010-2019 Intel Corporation
>   */
>  
>  #ifndef _RTE_COMMON_H_
> @@ -24,6 +24,11 @@ extern "C" {
>  
>  #include <rte_config.h>
>  
> +/* windows specific*/
> +#ifdef RTE_EXEC_ENV_WINDOWS
> +#include <rte_windows.h>
> +#endif
> +

IMO, Updating the rte_common.h for each execution environment is not
clean and unnecessary #ifdef clutter in the common code.

I think, it can be fixed by adding new os or eal specific header file
at the following location and simply include it(without any #ifdef)

lib/librte_eal/linux/eal/include/exec-env/rte_eal.h
lib/librte_eal/freebsd/eal/include/exec-env/rte_eal.h
lib/librte_eal/windows/eal/include/exec-env/rte_eal.h # the content of
exiting rte_windows.h goes here.

It can be rte_eal.h or rte_os.h or anything similar.
  
Harini Ramakrishnan March 26, 2019, 4:30 p.m. UTC | #2
-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.rawat@intel.com; pallavi.kadam@intel.com; ranjit.menon@intel.com; jeffrey.b.shaw@intel.com; bruce.richardson@intel.com; thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows

Added header files to support windows on x86 platforms.
Updated rte_common.h to include rte_windows.h for windows build. Updated lib/meson.build to create shared libraries on windows. Added def file to list the exports for the eal library.

Signed-off-by: Anand Rawat <anand.rawat@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>
---
 lib/librte_eal/common/include/rte_common.h    |  7 ++++-
 .../common/include/rte_string_fns.h           |  4 ++-
 lib/librte_eal/rte_eal_exports.def            |  9 ++++++
 .../windows/eal/include/rte_windows.h         | 30 +++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  2 ++
 lib/meson.build                               | 19 ++++++++++--
 6 files changed, 66 insertions(+), 5 deletions(-)  create mode 100644 lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,11 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@ extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..7805aeeaa
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -0,0 +1,9 @@
+EXPORTS
+	__rte_panic
+	rte_eal_get_configuration
+	rte_eal_init
+	rte_eal_mp_remote_launch
+	rte_eal_mp_wait_lcore
+	rte_eal_remote_launch
+	rte_log
+	rte_vlog
\ No newline at end of file
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_WINDOWS_H_
+#define _RTE_WINDOWS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+/* macro substitution for windows supported strerror_r */ #define 
+strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)	_strdup(str)
+
+/* macro substitution for windows supported ssize_t type */ typedef 
+SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */ #define 
+strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_WINDOWS_H_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
diff --git a/lib/meson.build b/lib/meson.build index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible @@ -64,6 +64,11 @@ foreach l:libraries
 	dir_name = 'librte_' + l
 	subdir(dir_name)
 
+	if host_machine.system() == 'windows'
+		# injecting rte_windows.h in every library in windows
+		includes += include_directories('librte_eal/windows/eal/include')
+	endif
+
 	if build
 		enabled_libs += name
 		dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1) @@ -117,14 +122,22 @@ foreach l:libraries
 			objs += static_lib.extract_all_objects(recursive: false)
 			version_map = '@0@/@1@/rte_@2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
+			exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				lk_args = ['-Wl,/def:' + exports, '-Wl,/implib:lib\\' + implib]
+			else
+				lk_args = ['-Wl,--version-script=' + version_map]
+			endif
 			shared_lib = shared_library(libname,
 					sources,
 					objects: objs,
 					c_args: cflags,
 					dependencies: shared_deps,
 					include_directories: includes,
-					link_args: '-Wl,--version-script=' + version_map,
-					link_depends: version_map,
+					link_args: lk_args,
+					link_depends: [version_map, exports],
 					version: lib_version,
 					soversion: so_version,
 					install: true)
--
2.17.1.windows.2
  
Menon, Ranjit March 27, 2019, 9:23 p.m. UTC | #3
On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
>> Added header files to support windows on x86 platforms.
>> Updated rte_common.h to include rte_windows.h for windows
>> build. Updated lib/meson.build to create shared libraries
>> on windows. Added def file to list the exports for the
>> eal library.
>>
>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
>> ---
>>   lib/librte_eal/common/include/rte_common.h    |  7 ++++-
>>   .../common/include/rte_string_fns.h           |  4 ++-
>>   lib/librte_eal/rte_eal_exports.def            |  9 ++++++
>>   .../windows/eal/include/rte_windows.h         | 30
>> +++++++++++++++++++
>>   lib/librte_eal/windows/eal/meson.build        |  2 ++
>>   lib/meson.build                               | 19 ++++++++++--
>>   6 files changed, 66 insertions(+), 5 deletions(-)
>>   create mode 100644 lib/librte_eal/rte_eal_exports.def
>>   create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
>>
>> diff --git a/lib/librte_eal/common/include/rte_common.h
>> b/lib/librte_eal/common/include/rte_common.h
>> index 7178ba1e9..4775c84f5 100644
>> --- a/lib/librte_eal/common/include/rte_common.h
>> +++ b/lib/librte_eal/common/include/rte_common.h
>> @@ -1,5 +1,5 @@
>>   /* SPDX-License-Identifier: BSD-3-Clause
>> - * Copyright(c) 2010-2014 Intel Corporation
>> + * Copyright(c) 2010-2019 Intel Corporation
>>    */
>>   
>>   #ifndef _RTE_COMMON_H_
>> @@ -24,6 +24,11 @@ extern "C" {
>>   
>>   #include <rte_config.h>
>>   
>> +/* windows specific*/
>> +#ifdef RTE_EXEC_ENV_WINDOWS
>> +#include <rte_windows.h>
>> +#endif
>> +
> 
> IMO, Updating the rte_common.h for each execution environment is not
> clean and unnecessary #ifdef clutter in the common code.
> 
> I think, it can be fixed by adding new os or eal specific header file
> at the following location and simply include it(without any #ifdef)
> 
> lib/librte_eal/linux/eal/include/exec-env/rte_eal.h
> lib/librte_eal/freebsd/eal/include/exec-env/rte_eal.h
> lib/librte_eal/windows/eal/include/exec-env/rte_eal.h # the content of
> exiting rte_windows.h goes here.
> 
> It can be rte_eal.h or rte_os.h or anything similar.
> 
> 
This was done based on a suggestion from Thomas:
(http://patches.dpdk.org/patch/50844/)

But, I agree. Your suggestion would be a good enhancement. There is 
already an existing rte_eal.h in common/include, so an rte_os.h or 
something similar might make sense.

ranjit m.
  
Thomas Monjalon March 27, 2019, 10:29 p.m. UTC | #4
27/03/2019 22:23, Ranjit Menon:
> On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> > On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> >> Added header files to support windows on x86 platforms.
> >> Updated rte_common.h to include rte_windows.h for windows
> >> build. Updated lib/meson.build to create shared libraries
> >> on windows. Added def file to list the exports for the
> >> eal library.
> >>
> >> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> >> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> >> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> >> ---
> >>   lib/librte_eal/common/include/rte_common.h    |  7 ++++-
> >>   .../common/include/rte_string_fns.h           |  4 ++-
> >>   lib/librte_eal/rte_eal_exports.def            |  9 ++++++
> >>   .../windows/eal/include/rte_windows.h         | 30
> >> +++++++++++++++++++
> >>   lib/librte_eal/windows/eal/meson.build        |  2 ++
> >>   lib/meson.build                               | 19 ++++++++++--
> >>   6 files changed, 66 insertions(+), 5 deletions(-)
> >>   create mode 100644 lib/librte_eal/rte_eal_exports.def
> >>   create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
> >>
> >> diff --git a/lib/librte_eal/common/include/rte_common.h
> >> b/lib/librte_eal/common/include/rte_common.h
> >> index 7178ba1e9..4775c84f5 100644
> >> --- a/lib/librte_eal/common/include/rte_common.h
> >> +++ b/lib/librte_eal/common/include/rte_common.h
> >> @@ -1,5 +1,5 @@
> >>   /* SPDX-License-Identifier: BSD-3-Clause
> >> - * Copyright(c) 2010-2014 Intel Corporation
> >> + * Copyright(c) 2010-2019 Intel Corporation
> >>    */
> >>   
> >>   #ifndef _RTE_COMMON_H_
> >> @@ -24,6 +24,11 @@ extern "C" {
> >>   
> >>   #include <rte_config.h>
> >>   
> >> +/* windows specific*/
> >> +#ifdef RTE_EXEC_ENV_WINDOWS
> >> +#include <rte_windows.h>
> >> +#endif
> >> +
> > 
> > IMO, Updating the rte_common.h for each execution environment is not
> > clean and unnecessary #ifdef clutter in the common code.
> > 
> > I think, it can be fixed by adding new os or eal specific header file
> > at the following location and simply include it(without any #ifdef)
> > 
> > lib/librte_eal/linux/eal/include/exec-env/rte_eal.h
> > lib/librte_eal/freebsd/eal/include/exec-env/rte_eal.h
> > lib/librte_eal/windows/eal/include/exec-env/rte_eal.h # the content of
> > exiting rte_windows.h goes here.
> > 
> > It can be rte_eal.h or rte_os.h or anything similar.
> > 
> > 
> This was done based on a suggestion from Thomas:
> (http://patches.dpdk.org/patch/50844/)
> 
> But, I agree. Your suggestion would be a good enhancement. There is 
> already an existing rte_eal.h in common/include, so an rte_os.h or 
> something similar might make sense.

Yes I agree with rte_os.h
  
Anand Rawat March 27, 2019, 11:10 p.m. UTC | #5
On 3/27/2019 3:29 PM, Thomas Monjalon wrote:
> 27/03/2019 22:23, Ranjit Menon:
> > On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> >> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> >>> Added header files to support windows on x86 platforms.
> >>> Updated rte_common.h to include rte_windows.h for windows
> >>> build. Updated lib/meson.build to create shared libraries
> >>> on windows. Added def file to list the exports for the
> >>> eal library.
> >>>
> >>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> >>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> >>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> >>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> >>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> >>> ---
> >>>    lib/librte_eal/common/include/rte_common.h    |  7 ++++-
> >>>    .../common/include/rte_string_fns.h           |  4 ++-
> >>>    lib/librte_eal/rte_eal_exports.def            |  9 ++++++
> >>>    .../windows/eal/include/rte_windows.h         | 30
> >>> +++++++++++++++++++
> >>>    lib/librte_eal/windows/eal/meson.build        |  2 ++
> >>>    lib/meson.build                               | 19 ++++++++++--
> >>>    6 files changed, 66 insertions(+), 5 deletions(-)
> >>>    create mode 100644 lib/librte_eal/rte_eal_exports.def
> >>>    create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
> >>>
> >>> diff --git a/lib/librte_eal/common/include/rte_common.h
> >>> b/lib/librte_eal/common/include/rte_common.h
> >>> index 7178ba1e9..4775c84f5 100644
> >>> --- a/lib/librte_eal/common/include/rte_common.h
> >>> +++ b/lib/librte_eal/common/include/rte_common.h
> >>> @@ -1,5 +1,5 @@
> >>>    /* SPDX-License-Identifier: BSD-3-Clause
> >>> - * Copyright(c) 2010-2014 Intel Corporation
> >>> + * Copyright(c) 2010-2019 Intel Corporation
> >>>     */
> >>>
> >>>    #ifndef _RTE_COMMON_H_
> >>> @@ -24,6 +24,11 @@ extern "C" {
> >>>
> >>>    #include <rte_config.h>
> >>>
> >>> +/* windows specific*/
> >>> +#ifdef RTE_EXEC_ENV_WINDOWS
> >>> +#include <rte_windows.h>
> >>> +#endif
> >>> +
> >>
> >> IMO, Updating the rte_common.h for each execution environment is not
> >> clean and unnecessary #ifdef clutter in the common code.
> >>
> >> I think, it can be fixed by adding new os or eal specific header file
> >> at the following location and simply include it(without any #ifdef)
> >>
> >> lib/librte_eal/linux/eal/include/exec-env/rte_eal.h
> >> lib/librte_eal/freebsd/eal/include/exec-env/rte_eal.h
> >> lib/librte_eal/windows/eal/include/exec-env/rte_eal.h # the content of
> >> exiting rte_windows.h goes here.
> >>
> >> It can be rte_eal.h or rte_os.h or anything similar.
> >>
> >>
> > This was done based on a suggestion from Thomas:
> > (http://patches.dpdk.org/patch/50844/)
> >
> > But, I agree. Your suggestion would be a good enhancement. There is
> > already an existing rte_eal.h in common/include, so an rte_os.h or
> > something similar might make sense.
>
> Yes I agree with rte_os.h
>
>
I can include this change in v6. I am looking to add rte_os.h under
windows/eal/include/exec-env/ and include the header in rte_common.h
as a separate patch. This change would require new files for linux and freebsd.
What be should be the content of that?
  
Thomas Monjalon March 27, 2019, 11:27 p.m. UTC | #6
28/03/2019 00:10, Anand Rawat:
> On 3/27/2019 3:29 PM, Thomas Monjalon wrote:
> > 27/03/2019 22:23, Ranjit Menon:
> > > On 3/26/2019 3:20 AM, Jerin Jacob Kollanukkaran wrote:
> > >> On Mon, 2019-03-25 at 23:02 -0700, Anand Rawat wrote:
> > >>> Added header files to support windows on x86 platforms.
> > >>> Updated rte_common.h to include rte_windows.h for windows
> > >>> build. Updated lib/meson.build to create shared libraries
> > >>> on windows. Added def file to list the exports for the
> > >>> eal library.
> > >>>
> > >>> Signed-off-by: Anand Rawat <anand.rawat@intel.com>
> > >>> Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
> > >>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > >>> Reviewed-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
> > >>> Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
> > >>> ---
> > >>>    lib/librte_eal/common/include/rte_common.h    |  7 ++++-
> > >>>    .../common/include/rte_string_fns.h           |  4 ++-
> > >>>    lib/librte_eal/rte_eal_exports.def            |  9 ++++++
> > >>>    .../windows/eal/include/rte_windows.h         | 30
> > >>> +++++++++++++++++++
> > >>>    lib/librte_eal/windows/eal/meson.build        |  2 ++
> > >>>    lib/meson.build                               | 19 ++++++++++--
> > >>>    6 files changed, 66 insertions(+), 5 deletions(-)
> > >>>    create mode 100644 lib/librte_eal/rte_eal_exports.def
> > >>>    create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h
> > >>>
> > >>> diff --git a/lib/librte_eal/common/include/rte_common.h
> > >>> b/lib/librte_eal/common/include/rte_common.h
> > >>> index 7178ba1e9..4775c84f5 100644
> > >>> --- a/lib/librte_eal/common/include/rte_common.h
> > >>> +++ b/lib/librte_eal/common/include/rte_common.h
> > >>> @@ -1,5 +1,5 @@
> > >>>    /* SPDX-License-Identifier: BSD-3-Clause
> > >>> - * Copyright(c) 2010-2014 Intel Corporation
> > >>> + * Copyright(c) 2010-2019 Intel Corporation
> > >>>     */
> > >>>
> > >>>    #ifndef _RTE_COMMON_H_
> > >>> @@ -24,6 +24,11 @@ extern "C" {
> > >>>
> > >>>    #include <rte_config.h>
> > >>>
> > >>> +/* windows specific*/
> > >>> +#ifdef RTE_EXEC_ENV_WINDOWS
> > >>> +#include <rte_windows.h>
> > >>> +#endif
> > >>> +
> > >>
> > >> IMO, Updating the rte_common.h for each execution environment is not
> > >> clean and unnecessary #ifdef clutter in the common code.
> > >>
> > >> I think, it can be fixed by adding new os or eal specific header file
> > >> at the following location and simply include it(without any #ifdef)
> > >>
> > >> lib/librte_eal/linux/eal/include/exec-env/rte_eal.h
> > >> lib/librte_eal/freebsd/eal/include/exec-env/rte_eal.h
> > >> lib/librte_eal/windows/eal/include/exec-env/rte_eal.h # the content of
> > >> exiting rte_windows.h goes here.
> > >>
> > >> It can be rte_eal.h or rte_os.h or anything similar.
> > >>
> > >>
> > > This was done based on a suggestion from Thomas:
> > > (http://patches.dpdk.org/patch/50844/)
> > >
> > > But, I agree. Your suggestion would be a good enhancement. There is
> > > already an existing rte_eal.h in common/include, so an rte_os.h or
> > > something similar might make sense.
> >
> > Yes I agree with rte_os.h
> >
> >
> I can include this change in v6. I am looking to add rte_os.h under
> windows/eal/include/exec-env/ and include the header in rte_common.h
> as a separate patch. This change would require new files for linux and freebsd.
> What be should be the content of that?

I think you can add empty files.
Later we may discover some definitions to move from common code to rte_os.h.
  

Patch

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -1,5 +1,5 @@ 
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,11 @@  extern "C" {
 
 #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -1,5 +1,5 @@ 
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@  extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like
diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..7805aeeaa
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -0,0 +1,9 @@ 
+EXPORTS
+	__rte_panic
+	rte_eal_get_configuration
+	rte_eal_init
+	rte_eal_mp_remote_launch
+	rte_eal_mp_wait_lcore
+	rte_eal_remote_launch
+	rte_log
+	rte_vlog
\ No newline at end of file
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -0,0 +1,30 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_WINDOWS_H_
+#define _RTE_WINDOWS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+/* macro substitution for windows supported strerror_r */
+#define strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)	_strdup(str)
+
+/* macro substitution for windows supported ssize_t type */
+typedef SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_WINDOWS_H_ */
diff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -1,6 +1,8 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
diff --git a/lib/meson.build b/lib/meson.build
index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -1,5 +1,5 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible
@@ -64,6 +64,11 @@  foreach l:libraries
 	dir_name = 'librte_' + l
 	subdir(dir_name)
 
+	if host_machine.system() == 'windows'
+		# injecting rte_windows.h in every library in windows
+		includes += include_directories('librte_eal/windows/eal/include')
+	endif
+
 	if build
 		enabled_libs += name
 		dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1)
@@ -117,14 +122,22 @@  foreach l:libraries
 			objs += static_lib.extract_all_objects(recursive: false)
 			version_map = '@0@/@1@/rte_@2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
+			exports = '@0@/@1@/rte_@2@_exports.def'.format(
+					meson.current_source_dir(), dir_name, name)
+			implib = dir_name + '.dll.a'
+			if host_machine.system() == 'windows'
+				lk_args = ['-Wl,/def:' + exports, '-Wl,/implib:lib\\' + implib]
+			else
+				lk_args = ['-Wl,--version-script=' + version_map]
+			endif
 			shared_lib = shared_library(libname,
 					sources,
 					objects: objs,
 					c_args: cflags,
 					dependencies: shared_deps,
 					include_directories: includes,
-					link_args: '-Wl,--version-script=' + version_map,
-					link_depends: version_map,
+					link_args: lk_args,
+					link_depends: [version_map, exports],
 					version: lib_version,
 					soversion: so_version,
 					install: true)