• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to create pass-through (stub) dylib without using flat namespaces?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re:Non-priv way to collect job stats under Intel?
  • Next by Date: Re: Non-priv way to collect job stats under Intel?
  • Previous by thread: build perl
  • Next by thread: Get the caller of socket_lock()
  • Index(es):
    • Date
    • Thread