linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Hiding inter-library dependencies.
@ 2016-08-16 14:14 Daniel.
  2016-08-16 16:43 ` Daniel.
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel. @ 2016-08-16 14:14 UTC (permalink / raw)
  To: linux-c-programming@vger.kernel.org

Hi everybody!

Suppose that I have 3 shared files,
and two target machines M1 and M2.

libA.so, libB.so and libC.so.

libB.so is linked against libA.so only when compiled
to M1, but not in M2.

libC.so is aways linked against libB.so

So we have:

M1: libA.so <- libB.so <- libC.so <- executable.
M2:                   libB.so <- libC.so <-executable

I want to hide libA.so need while linking libB,
so that libC has not to pass -lA to linker depending
on machine. And to
hide libB and libA while linking to libC, so that
the user need to pass only -lC. Is that possible?

For example, linking in M1 would be:
cc -fPIC -shared -o libA.so libA.c
cc -fPIC -shared -o libB.so libB.c -lA
cc -fPIC -shared -o libC.so libC.c -lB (no need to -lA is the point here)
cc -o executable executable.c -lC (no need to -lB -lA is the point here)

And for M2 would be:
cc -fPIC -shared -o libB.so libB.c
cc -fPIC -shared -o libC.so -lB
cc -o executable executable.c -lC

In both cases (machines) the compilation of executable and libC
is done by the same command line.


Cheers,


-- 
"Do or do not. There is no try"
  Yoda Master

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-16 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-16 14:14 Hiding inter-library dependencies Daniel.
2016-08-16 16:43 ` Daniel.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).