How to create pass-through (stub) dylib without using flat namespaces?
How to create pass-through (stub) dylib without using flat namespaces?
- Subject: How to create pass-through (stub) dylib without using flat namespaces?
- From: Simon Urbanek <email@hidden>
- Date: Tue, 1 Aug 2006 21:29:36 -0400
I need to create a dylib (A) that links to another dylib (B) such
that linking to A is sufficient to get the symbols of B (without
linking directly to B).
i.e. something like this:
B.c:
void foo1() {... };
void foo2() {... };
[...]
gcc -dynamiclib -o libB.dylib B.c
A.c:
void dummy() { foo1(); foo2(); ... }
[just to make sure all symbols are there - could be empty, too]
gcc -dynamiclib -o libA.dylib A.c -L. -lB
prog.c:
int main(int argc, char **argv) {
foo1();
return 0;
}
gcc -o prog prog.c -L. -lA
As-is it won't work, because the symbols in libB are visible only to
libA and not to the prog. So I need some way to make all symbols in B
exported through A. I cannot use flat name space - so please discard
that right away. In fact I cannot change any flags of prog, so using -
undefined dynamic_lookup for prog is not an option, either.
I know that a solution exists, because that is what Apple's
frameworks do if they have sub-frameworks or libs (e.g. have a look
at vecLib - it contains no symbols itself but collects all symbols of
the libraries it is linked to) and they use two-level namespaces.
This is exactly what I need. I couldn't find anything in ld/gcc/dyld,
though.
Any help is highly appreciated.
Thanks,
Simon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden