Linking Stub functions for testing

Chris Torek chris at mimsy.UUCP
Sat Mar 11 14:23:57 AEST 1989


In article <3898 at crash.cts.com> mstreet at crash.cts.com (Michael Street) writes:
>I'm trying to test a C source code file that contains several separate
>functions, one function at a time. To do this, I need to stub out the
>other functions by linking in stub functions of the same name. I have
>not been able to determine how to do this as the linker returns a 
>multiply defined symbol error.

The .o file formats commonly found on Unix systems do not have
sufficiently detailed information to permit loading only the relevant
function(s) and data.  Instead, the linker must read the entire .o
file.  If you want to replace any particular function, you must supply
all symbols needed by the time ld gets around to noticing that .o file
(which must be an archive entry; ld loads all files whose names end in
.o whether needed then or not).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.questions mailing list