I'm trying to use the weak attribute for the some public API definition to replace once the real APIs were NOT linked.
The step I did is like below:
1. Put kinds of components APIs /w weak attribute function definition in one "c" file, and build it out as a library. Name it "libweak" since all functions in it is weak definition.
And these APIs by components named "libweak.A", "libweak.B", "libweak.C" etc.
2. For these components APIs, there are strong implementation in other libraries, named "libstrong.A", "libstrong.B", "libstrong.C"
3. Now, in the final image linking once libstrong.B was removed, the final image may link libweak.B, libweak.A, libstrong.C.
while the expectation linking is libweak.B, libstrong.A, libstrong.C
* I don't know following info. will help:
The APIs of B were referenced by the c file in the project which produces the final image.
The Weak references and definitions has already referenced but didn't find the answer to this problem.
My Keil version is 5.17
Any idea on it ?
Thanks in advance
I made a short test based on your information. But all works as expected. See also the attached image for reference.
I also used the toolchain version 5.06u1, which is included in MDK 5.17. So, without more details from your side, it is hardly possible to comment on your issue.
View all questions in Keil forum