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: Tue, 03 Jan 2012 09:44:43 -0800
On Jan 2, 2012, at 6:27 PM, Grandinetti Philip wrote:
> But I'm troubled by this solution. If I set debugger break points in the "Units" library the debugger no longer stops at those breakpoints when called by the plugin, but it does stop at those breakpoints when called by the main app. Makes me think I have two copies of code for my static units library running after the plugin is loaded. Does that make sense?
Yes. That’s what a static library is. As I said, it gets *copied* into the binary at link time. So you do have two copies of the code for the units library. If you only want one copy of the code, make a dynamic library instead (or a framework, which is just a dynamic library packaged with header files and resources.)
If you make Units a dynamic library, you won’t have to mess with CFBundleGetDataPointerForName either. Just make sure ‘unitsLibrary’ gets exported from Units, and declare it extern in the code that wants to use it.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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