Hi John.

Thanks for the feedback.

It turns out that the GCC-driving IDE I was using (yeah, I wasn't running from the command line :o ) was inadvertently placing some .o modules after the library argument to the linker. Therefore the linker was complaining. Once I got that sorted out, the linker happily took the "override" module instead of the dummy in the library.

I will see if I can incorporate your solution anyway,  as it's fail-safe.

Thanks for the response,

 ______________________________________
  Andrew E. Kalman, Ph.D.   a...@pumpkininc.com


Hi Andrew

The safest and least complicated brute force approach is probably as
follows.

Assuming the new foo is in a library called overrides.lib, add an
additional undefined symbol option for the linker in addition to the
library.

-Wl,-u,foo -loverrides

This way there is no confusion about WHEN the linker should start to
look for which version of foo to pull in, rather than leaving the
linker choose arbitrarily from libaries already scanned. Standard
libraries are scanned last.

If foo is not in a library then the solution is even simpler. Make
sure the object file is on the linker command line before the libary
which foo overrides.


John Heenan



From: Andrew Kalman <a...@pu...>
 Overriding Library Modules with a User Module?
2005-08-28 10:57
 Does anyone know if it's possible to build a project that references
 a library module and have ld override the build with a user module of
 the same name?

 E.g. if a standard library has a function foo() and the user creates
 their own function foo(), how do you instruct the linker to use the
 user's function in place of the library function, and not issue
 warnings / errors, etc?

 Thanks,
 --
   ______________________________________
    Andrew E. Kalman, Ph.D.   a...@pu...





--


Reply via email to