From: "Daniel." <danielhilst@gmail.com>
To: "linux-c-programming@vger.kernel.org"
<linux-c-programming@vger.kernel.org>
Subject: Hiding inter-library dependencies.
Date: Tue, 16 Aug 2016 11:14:16 -0300 [thread overview]
Message-ID: <CAF3SDA7nNWNCrfY3MT8PfU6kU7E8JjLnPXcohJL896_o3hGWcQ@mail.gmail.com> (raw)
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
next reply other threads:[~2016-08-16 14:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-16 14:14 Daniel. [this message]
2016-08-16 16:43 ` Hiding inter-library dependencies Daniel.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAF3SDA7nNWNCrfY3MT8PfU6kU7E8JjLnPXcohJL896_o3hGWcQ@mail.gmail.com \
--to=danielhilst@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).