[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Should .a library contains non-reallocatable code?



Bernhard R. Link writes ("Re: Should .a library contains non-reallocatable code?"):
> Ian Jackson <ijackson@chiark.greenend.org.uk> [150224 15:50]:
> > + gcc -Wall main.c -L. -lbar1 -lbar2
> 
> You forgot to change that line as I said to change it.

Ah yes, sorry.  I can reproduce the problem that way.
It works if I say
  gcc -Wall main.c -L. -lbar1 -lbar2 -lfoo
but not the other way round.

> main.c now uses libfoo1 and libbar2, so in my example I build against
> those.  Now you only need a bit of bad luck to use -lbar2 -lfoo1 in
> that order and you get the problem.

Right.  I think that the right answer to this, in these cases, is
either to use an explicit symbol export file or to adjust the link
command lines.

Doing it the other way (not including libfoo.a in libbar.so) doesn't
work properly at all for the reasons I've explained.

Ian.


Reply to: