Re: Static variables reset inside CFPlugin code
Re: Static variables reset inside CFPlugin code
- Subject: Re: Static variables reset inside CFPlugin code
- From: Jens Alfke <email@hidden>
- Date: Mon, 02 Jan 2012 10:22:36 -0800
On Jan 2, 2012, at 7:52 AM, Grandinetti Philip wrote:
> You raise a fundamental issue that I admit I don't completely understand. What are the differences between linking against a static library versus a framework. If I turned all my static libraries into a framework would the plugin see the static variables in the framework without having to do all the Xcode linking magic?
The difference is copying vs. referencing. A static library gets copied into the target at link time, whereas if you link with a dynamic library or framework, the linker just notes down what symbols are referenced, and at load time those get resolved to those symbols in the library.
For your purposes, the difference is that in a static library, everything that links with it has its own private copy of the library's global variables. In a dylib/framework, everything that links with it shares its global variables. The latter is what you want.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden