Problems with ar(1) and modified objects

ebk at iedl02.UUCP ebk at iedl02.UUCP
Sat Apr 14 12:17:31 AEST 1984


Creating an archive with your object files and ranlib'ing it is not really
much faster than doing a cc ${OBJECTS}, since ld still needs to go through
each module. If you really want to do this, though, you will need
to do a bit more than just ld <archive_file>.
ld only loads archive members necessary to satisfy any undefined externals.
either leave your main module out of the archive and
cc -o int main.o tempint
or use the -u flag of ld: ld -u main -o int tempint

You should almost always use cc instead of ld, since there are several
switches that need to be used in the ld invocation that cc provides,
which are dependent on the implementation, whether you are using a floating
point simulator and/or profiling, overlays, etc.

John Owens
~e



More information about the Comp.unix.wizards mailing list