On 18-Feb-21 6:56 PM, hamidreza Kheirabadi wrote:
Hi,
I'd like to change my dpdk-based application from a pure C to C++ version.
Can anybody help me with a sample cmake or Makefile?
Is there any performance degradation when compiling apps with g++ instead
of gcc?
Regards


Hi,

We have documented examples for building external applications with Make and Meson [1], but not CMake. Still, i imagine it would be pretty straightforward because CMake will use pkg-config under the hood when resolving dependencies.

If DPDK is installed onto your local system (using `ninja install` command), things should Just Work (tm). If you only have a local compiled version of DPDK, you may still compile/link against it using `<build-dir>/meson-uninstalled` directory which will have a pkg-config file that will allow you to get all necessary paths/includes. (you may need to set PKG_CONFIG_DIR environment variable, or its CMake equivalent, for pkg-config to find DPDK)

The DPDK examples have Makefiles that is self-contained and should be a good basis for building any external application as well.

As for the question of C++, I've written C++ DPDK applications before, and i haven't noticed any performance degradation. Obviously the kind of features you plan on using (e.g. exceptions, dynamic dispatch, etc.) will determine the performance impact you may or may not get, but seeing how C++ model is "not paying for abstractions you don't use", I imagine that a carefully designed C++ application will perform just as well as a C application, with roughly half the code :D

[1] http://doc.dpdk.org/guides/linux_gsg/build_dpdk.html#building-applications-using-installed-dpdk

--
Thanks,
Anatoly

Reply via email to