• 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
Weak Linking Crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weak Linking Crash


  • Subject: Weak Linking Crash
  • From: Simone Manganelli <email@hidden>
  • Date: Wed, 11 Mar 2009 17:47:41 -0700

So I'm trying to weak link the SDL_mixer framework (svn source avaliable here: http://svn.libsdl.org/trunk/SDL_mixer ) to a Cocoa project, the Mac OS X port of Descent 2 (svn source available here: https://d2x-xl.svn.sourceforge.net/svnroot/d2x-xl ).

I've followed the instructions on Apple's website about weak linking (see http://developer.apple.com/DOCUMENTATION/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html ). Specifically, I've added "-weak_framework SDL_mixer" in my Other Linker Flags build setting.

Here's the problem: weak linking works well under *unoptimized* builds, but fails in *optimized* builds. The program launches correctly both with and without SDL_mixer present when unoptimized. However, as soon as I turn on optimization, the program crashes when the SDL_mixer framework is not present. The optimized build continues to work fine when the SDL_mixer framework *is* present.

Since I'm shipping an optimized version, weak linking in this case is useless, because it provides no benefit over not weak linking. The program simply crashes if SDL_mixer is not present, no matter if it has been weak linked or not.

The crash seems to occur *before* any code in my application; it crashes when trying to send an appDidFinishLaunching notification. Here is a partial stack trace:

Thread 0 Crashed:
0 ??? 0000000000 0 + 0
1 de.descent2.d2x-xl 0x0008bda3 0x1000 + 568739
2 de.descent2.d2x-xl 0x0008f7ed 0x1000 + 583661
3 de.descent2.d2x-xl 0x0008fb9c 0x1000 + 584604
4 de.descent2.d2x-xl 0x00057fc3 0x1000 + 356291
5 com.apple.Foundation 0x90b53f1c _nsnote_callback + 364
6 com.apple.CoreFoundation 0x93ea38da __CFXNotificationPost + 362
7 com.apple.CoreFoundation 0x93ea3bb3 _CFXNotificationPostNotification + 179
8 com.apple.Foundation 0x90b51080 -[NSNotificationCenter postNotificationName:object:userInfo:] + 128
9 com.apple.Foundation 0x90b5a8c8 -[NSNotificationCenter postNotificationName:object:] + 56
10 com.apple.AppKit 0x91c8f49a -[NSApplication _postDidFinishNotification] + 125
11 com.apple.AppKit 0x91c8f3a9 -[NSApplication _sendFinishLaunchingNotification] + 77
12 com.apple.AppKit 0x91c08ec3 - [NSApplication(NSAppleEventHandling) _handleAEOpen:] + 284
13 com.apple.AppKit 0x91c086bc - [NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 98
14 com.apple.Foundation 0x90b7943f -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 655
15 com.apple.Foundation 0x90b7914f _NSAppleEventManagerGenericHandler + 223
16 com.apple.AE 0x916b1648 aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*) + 144
17 com.apple.AE 0x916b157e dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 44

The whole crash report can be found here: http://homepage.mac.com/simx/weak_linking_crash_log.txt .


Anybody know what's going on here and how to solve it? The intarwebs and the Googles don't seem to be providing anything relevant.

Thanks in advance for any assistance.

-- Simone
_______________________________________________

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


  • Follow-Ups:
    • Re: Weak Linking Crash
      • From: Greg Parker <email@hidden>
  • Prev by Date: Re: Garbage collected and non-garbage collected
  • Next by Date: Re: Weak Linking Crash
  • Previous by thread: Re: Karaoke like algorithm
  • Next by thread: Re: Weak Linking Crash
  • Index(es):
    • Date
    • Thread