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