[dpdk-dev] [PATCH] eal: fix c++ compilation issue with rte_delay_us()
Ananyev, Konstantin
konstantin.ananyev at intel.com
Wed Oct 5 12:17:40 CEST 2016
Hi Thomas,
>
> 2016-10-03 18:27, Konstantin Ananyev:
> > When compiling with C++, it treats
> > void (*rte_delay_us)(unsigned int us);
> > as definition of the global variable.
> > So further linking with librte_eal fails.
> >
> > Fixes: b4d63fb62240 ("eal: customize delay function")
>
> Applied, thanks
>
> I don't understand why it was not failing with C compilation?
Don't know off hand.
Yes, I would expect gcc to fail with same symptoms too.
But by some reason it puts it makes it a 'common' symbol:
$ cat rttm1.c
#include <stdio.h>
#include <rte_eal.h>
#include <rte_cycles.h>
int main(int argc, char *argv[])
{
int ret = rte_eal_init(argc, argv);
rte_delay_us(1);
printf("return code: %d\n", ret);
return ret;
}
$ gcc -m64 -pthread -o rttm1 rttm1.o -ldl -L/${RTE_SDK}/${RTE_TARGET}/lib -Wl,-lrte_eal
$ nm rttm1.o | grep rte_delay_us
0000000000000008 C rte_delay_us
Konstantin
More information about the dev
mailing list