0

How do I debug the below issue:

File 1.c

void __attribute__((weak)) funcA () {
  printf("Weak fn");
}

1.c is part of a library libA

Now I added a stronger definition for this function in another file.

File 2.c

void funcA () {
  printf("Strong fn");
}

2.c is part of library libB

Now I include libB to libA. But when running the code I see that the weaker function is getting executed instead.

How do I debug this? I've tried nm to look for funcA, it shows as 'W' under libA, and 'T' under libB.

adizone
  • 173
  • 1
  • 2
  • 11
  • 1
    `I include libB to libA` How do you do that exactly? Are the libraries static or shared? Does https://stackoverflow.com/questions/51656838/attribute-weak-and-static-libraries/ answer your question? – KamilCuk Mar 24 '22 at 08:47

0 Answers0