Hi! On Fri, Apr 28, 2006 at 07:33:12AM -0400, Andrew J. Kroll wrote: > When ld65 does a search, does it replace functions from earlier libraries? If the linker is forced to include a module that contains a duplicate symbol definition, it will say so (produce an error message). Otherwise it will ignore the second definition. This way, you can supply replacements for functions that are in the standard library by adding them as object files to the linker command line *before* the standard library. > For example, if I have a new printf function, which is already in the regular > libc, and I want to replace it with my own, if I link it in AFTER will it > replace the libc version, or do I link it in BEFORE so that it isn't searched > for in the libc to begin with? This is not as easy as it looks, because your code may reference a function in the library, which in turn references printf. If the link order is as follows: my_main my_printf runtime-lib my_main references a symbol foo, which is in the runtime library, and foo needs a symbol printf, my_printf is not considered again - if you don't use library groups. If you're going to replace standard functions, there are two solutions that do always work: * Include your function as an object file *before* the standard library. * Remove the implementation from the standard library. All other solutions need special considerations to make them work. Regards Uz -- Ullrich von Bassewitz uz@musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Sat Apr 29 13:57:08 2006
This archive was generated by hypermail 2.1.8 : 2006-04-29 13:57:11 CEST