[dpdk-dev] C++ app does not execute DPDK constructors.

Sachin Jain mail.sachin.jain at gmail.com
Mon Jan 6 22:24:36 CET 2020


Hi

*What am I trying to do?*

I am trying to write Gtests for my application based on DPDK.

*Details about the app:*

The application compiles dpdk as static library. Its a pretty simple. For
now it just runs a dummy Gtest and create a memory pool. The key is, its a
C++ file. I see no issue if it were a C app.

*Issue I am facing:*

The call to rte_mempool_create fails() with "Err: No such file or
directory".

*More debugging:*

The reason for the above failure is, the constructor for the ring driver is
not getting called. Specifically below code in
~/driver/mempool/ring/rte_mempool_ring.c.

MEMPOOL_REGISTER_OPS(ops_mp_mc);
MEMPOOL_REGISTER_OPS(ops_sp_sc);
MEMPOOL_REGISTER_OPS(ops_mp_sc);
MEMPOOL_REGISTER_OPS(ops_sp_mc);

So when I look at the C app which has these constructors called, I see the
init_array size to be much larger than the the C++ app. Considering the two
code are almost identical, I don't know what am I missing to have these
constructors run. They are definitely getting compiled but are not called.

*What have I tried:*

1. I tried the --whole-archive LD option but I dont think that should play
a part here since the constructors does get called with C app.

Any suggestions?

Regards
Sachin.


More information about the dev mailing list