Let's assume that I have the following C code:
extern int f_1();
extern int g_1();
extern int f_2();
extern int g_2();
extern int f_3();
extern int g_3();
int main(int argc, char **argv) {
// Using f_1, f_2, f_3 and g_1, g_2, g_3 here:
...
}
And I want to build it by linking with 3 different libraries: l1
, l2
, l3
-- assuming each of them exports its own f
and g
functions -- so that:
f_1
andg_1
will be resolved tof
andg
respectively froml1
;f_2
andg_2
will be resolved tof
andg
respectively froml2
;f_3
andg_3
will be resolved tof
andg
respectively froml3
.
Is this possible with gcc and ld:
- Is this possible if
l1
,l2
,l3
are shared libraries (.so)? - Is this possible if
l1
,l2
,l3
are archives (.a)?