Hello Dimitry, thank you! I got it working now using /WHOLEARCHIVE. I just needed to link mlx5devx.lib from the DevX SDK as well to my application.
Kind regards, Robert -----Ursprüngliche Nachricht----- Von: Dmitry Kozlyuk <[email protected]> Gesendet: Freitag, 11. November 2022 15:49 An: Robert Hable <[email protected]> Cc: [email protected] Betreff: Re: rte_eth_dev_count_avail returns different value in library 2022-11-11 13:51 (UTC+0000), Robert Hable: > Hello Dimitry, > > Yes, I am building DPDK as static library. As far as I have seen it should > also be the default option on windows builds? DPDK builds both static and dynamic libraries by default ("default_library=static" means that DPDK apps will use static libraries). However, DLLs don't work on Windows currently. > I tried linking the following libraries to my application, which is using my > own dpdk-library, but I had no success in using any dpdk functionality > (rte_eth_dev_count_avail() returns 0). > In the linker output I found out that the libraries are currently unused: > > 1>Unused libraries: > 1> C:\Dev\Extern\dpdk\build\lib\librte_eal.a > 1> C:\Dev\Extern\dpdk\build\lib\librte_mbuf.a > 1> C:\Dev\Extern\dpdk\build\lib\librte_mempool.a > 1> C:\Dev\Extern\dpdk\build\lib\librte_ethdev.a I'm puzzled why these four are unused. If the DLL using rte_eth_dev_count_avail() links successfully, the linked must use "librte_ethdev.a". > 1> C:\Dev\Extern\dpdk\build\drivers\librte_common_mlx5.a > 1> C:\Dev\Extern\dpdk\build\drivers\librte_net_mlx5.a > > Do you have any other ideas what I am missing there and why they are not > linked to it? Is it may be possible to include all the PMD libraries already > in my own library, so I only need to link against one library? > Yes, rte_eth_dev_count_avail() is called directly after rte_eal_init(). > > By the way I am using the visual studio 2022 compiler to build my own > application and clang for compiling dpdk if that matters. Please try /WHOLEARCHIVE for these libraries as documented here: https://learn.microsoft.com/en-us/cpp/build/reference/wholearchive-include-all-library-object-files?view=msvc-160 On Unices, PMDs are also linked using a similar --whole-archive option. This is needed because there are no direct references from DPDK libraries to PMDs, because PMDs register themselves at startup.
