• 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: Using weak linking and other techniques with non-Apple libs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using weak linking and other techniques with non-Apple libs


  • Subject: Re: Using weak linking and other techniques with non-Apple libs
  • From: Peter O'Gorman <email@hidden>
  • Date: Tue, 26 Feb 2008 00:27:08 -0600

David Elliott wrote:

> Actually they could reduce it to compat 5.0.0, current 7.0.0 and no
> existing apps would break.

David,

I have to correct your impression that the number passed as an argument
to the ld flag -current_version has some effect on the dynamic linker.

Here's a quick test of that:

$ cat foo.c
int foo() { return 1;}
$ cat main.c
extern int foo(void);

int main() { return foo(); }
$ mkdir lib
$ gcc -dynamiclib -o lib/libfoo.dylib foo.c -install_name
`pwd`/lib/libfoo.dylib -compatibility_version 7.0.0 -current_version 7.0.0
$ gcc -o main main.c -Llib -lfoo
$ ./main
$ echo $?
1

Now to relink the shared library with a lower compatibility version (but
keep current version the same).

$ gcc -dynamiclib -o lib/libfoo.dylib foo.c -install_name
`pwd`/lib/libfoo.dylib -compatibility_version 5.0.0 -current_version 7.0.0
$ ./main
dyld: Library not loaded: /Users/peter/tmp/ldcheck/lib/libfoo.dylib
  Referenced from: /Volumes/Users/peter/tmp/ldcheck/./main
  Reason: Incompatible library version: main requires version 7.0.0 or
later, but libfoo.dylib provides version 5.0.0
Trace/BPT trap

So, you see, that the -current_version flag has no effect on the dynamic
linker, the compatibility version is the only one checked by dyld.

Peter
--
Peter O'Gorman
http://pogma.com
 _______________________________________________
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

References: 
 >Using weak linking and other techniques with non-Apple libs (From: David Elliott <email@hidden>)
 >Re: Using weak linking and other techniques with non-Apple libs (From: Peter O'Gorman <email@hidden>)
 >Re: Using weak linking and other techniques with non-Apple libs (From: David Elliott <email@hidden>)
 >Re: Using weak linking and other techniques with non-Apple libs (From: Peter O'Gorman <email@hidden>)
 >Re: Using weak linking and other techniques with non-Apple libs (From: David Elliott <email@hidden>)

  • Prev by Date: Re: Using weak linking and other techniques with non-Apple libs
  • Next by Date: Re: Start of Volume on Mac Intel
  • Previous by thread: Re: Using weak linking and other techniques with non-Apple libs
  • Next by thread: DHCPv6 client support or third-party client?
  • Index(es):
    • Date
    • Thread