• 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
Re: Converting a set of static libraries to dynamic
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting a set of static libraries to dynamic


  • Subject: Re: Converting a set of static libraries to dynamic
  • From: "Peter O'Gorman" <email@hidden>
  • Date: Mon, 21 Aug 2006 21:56:01 +0900


On Aug 19, 2006, at 4:46 AM, Ken Turkowski wrote:

The problem is that the symbols aren't exported unless linked with something.

Maybe I can get a symbol list from the static libraries and submit them when making a DLL?

gcc -nostdlib -dynamiclib -o libfoo.dylib -all_load libfoo.a - lSystem -install_name /usr/local/lib/libfoo.dylib


Will work in many circumstances, however, you may find that you need things provided by libgcc or libSystemStubs etc, and it is very unlikely that you will want to load all members of those archives into your dynamic shared library.

I suggest extracting the archive first and then using the objects to make a shared libarary, e.g.:

mkdir fooobj
cd fooobj
ar x ../libfoo.a
gcc -dynamiclib -o ../libfoo.dylib *.o -install_name /usr/local/lib/ libfoo.dylib
cd ..
rm -rf fooobj


Note that ar x only works with thin archives and universal archives that have not had ranlib run on them, if you happen to have a universal archive that has had ranlib run on it you will first have to thin the archive with lipo before running ar x on it.

Hope this helps.
Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Converting a set of static libraries to dynamic (From: Ken Turkowski <email@hidden>)

  • Prev by Date: Re: Built-in gcc defines
  • Next by Date: weak_library, tidy, i386
  • Previous by thread: Re: Converting a set of static libraries to dynamic
  • Next by thread: Internal compiler error: Bus error
  • Index(es):
    • Date
    • Thread