• 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: Static data member behaviour in release builds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Static data member behaviour in release builds


  • Subject: Re: Static data member behaviour in release builds
  • From: Steve Baxter <email@hidden>
  • Date: Wed, 17 Aug 2005 11:44:58 +0100

Hi All,

Thanks to all those that replied. The problem was that the plugins were linking to a different copy of the shared framework which in turn was in a different location at runtime (they were linking to the debug version of the framework). This meant that the plugins were getting a different static to the application and "correct" shared framework. The solution was to set the path for my framework to be "relative to build product" so the release version was correctly linked.

Cheers,

Steve.

On 17 Aug 2005, at 09:24, Jack Nutting wrote:

On 8/16/05, Steve Baxter <email@hidden> wrote:

Hi,

I have a strange problem.  I have a class that has a static data
member.  This class is implemented in a shared framework and is
linked to by an application and several other plugins (implemented as
bundles).

In debug mode everything works fine - the app and plugins all share
the same static data member.

In release mode this fails to work properly - it looks like each app
and plugin gets its *own* copy of the static data member.  This then
causes our application to fail (the static is actually a pointer to a
singleton which is initialised by the app and accessed by the app and
all the plugins).

The only differences I can see between the release and debug builds are:

- Optimisation on in release mode
- Release strips dead code
- In debug mode the plugins, app and framework are "side by side"
- In release mode the plugins, app and framework are assembled into
the app's bundle

I am a bit stumped by this.  So far I have not been able to debug a
release build - if you click build and debug it builds the release
app and then runs the debug version.  Anyone got any ideas?


I can only guess why that's happening, perhaps something to do with how symbols are being exported from the framework. But, I have an idea for a workaround: make an accessor for this in your application, either a function or method of some existing class, so that plugins can grab the application's "version" of the static data instead of asking the framework for it directly.

--
// jack
// http://www.nuthole.com

Stephen Baxter Software Development Manager Improvision email@hidden +44-2476-692229


_______________________________________________ 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
  • Follow-Ups:
    • Re: Static data member behaviour in release builds
      • From: Steve Baxter <email@hidden>
References: 
 >Static data member behaviour in release builds (From: Steve Baxter <email@hidden>)
 >Re: Static data member behaviour in release builds (From: Jack Nutting <email@hidden>)

  • Prev by Date: Warning on cast but API says it's fine.
  • Next by Date: Adding a symlink (not its target) to a project (libz.dylib post security update)
  • Previous by thread: Re: Static data member behaviour in release builds
  • Next by thread: Re: Static data member behaviour in release builds
  • Index(es):
    • Date
    • Thread