Hiding inter-library dependencies.

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux