static and dynamic linking (Re: best way to get rate conversion)
static and dynamic linking (Re: best way to get rate conversion)
- Subject: static and dynamic linking (Re: best way to get rate conversion)
- From: Brian Willoughby <email@hidden>
- Date: Sat, 12 Oct 2002 14:39:03 -0700
Phil Burk <email@hidden> asks:
[ > [ If I compile the code on Jaguar, will it execute on pre-Jaguar
[ > [ systems? In other words is it statically linked with the new units
[ > [ or are they dynamically linked?
[ >
[ > Even with dynamic linking, a program will not run if it accesses API that
[ > did not exist pre-Jaguar.
[
[ Do you mean "BECAUSE of dynamic linking"?
I wouldn't quite put it that way, but you have pointed out that I was not
precise in my answer. Any kind of linking will fail if the API changes
significantly.
[ Generally, if a feature is dynamically linked, then an application
[ won't run on older systems because the dynamic library is missing.
True: if the dynamic library (or framework) is completely missing, then the
application will not start, and there will be a message on the Unix stdout
listing the library that was not found.
In this case, there is a CoreAudio library on both 10.1 and 10.2, but the API
is different. Since CoreAudio is C, there might be an immediate failure.
Note that with frameworks like the AppKit that are written in the dynamic
language Objective C, the link will not fail even though at run time the
application may call methods which have not been loaded. I think my experience
may be more appropriate with regards to Objective C frameworks than with
CoreAudio.
[ But if the feature is statically linked then it might work on
[ older system because the feature is carried along with the
[ application.
You'll find that static linking is not frequently used in Cocoa. All the
frameworks are dynamically linked. I'm not so sure about Carbon, but all of
the Carbon apps I've examined used dynamic linking to load the standard
frameworks.
[ So if the new AUConverter feature is statically linked with my
[ app, I may be able to compile it on Jaguar but run it on old 10.1
[ systems. Unfortunately, I believe that it is dynamically linked.
[ So I will need to restrict myself to features available in the
[ 10.1 SDK if I want to run on most OS X Macs.
I don't think it's possible to statically link in the CoreAudio library
because it calls into the operating system at some point. Therefore CoreAudio
would have to be dynamically linked with the system even if your app was
statically linked to CoreAudio, thus defeating the advantages of static
linking.
With dynamic linking, old CoreAudio apps will gain most new CoreAudio updates
(like bug fixes) even if they are not coded to access new features or expanded
parameters. I wonder if this means you can carefully avoid certain calls,
develop on 10.2, and still run on 10.1?
The more I say, the more likely I've said something incorrect :-)
Brian Willoughby
Sound Consulting
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.