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

weak linking


  • Subject: weak linking
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Sun, 30 Mar 2008 01:32:39 +0100


I use in some Cocoa app a weak linked library.

In some class I do:

- (BOO)haveNoLibrary
{
	BOOL noHave1 = weak_function == NULL ;	//	does NOT work - is always NO

void *dummy = weak_function;
BOOL noHave2 = dummy == NULL ; // does work - is YES if and only library is missing


	return noHave2;
}

Why is noHave1 always NO?

Next I copied some code from the Framework Programming Guide - Frameworks and Weak Linking:

if (weak_function == NULL)
{
	NSLog(@"%s weak_function %p NULL", __FUNCTION__, weak_function );
}
else
{
	NSLog(@"%s weak_function %p non-NULL", __FUNCTION__, weak_function );
}

The result without library is:
... weak_function 0x0 non-NULL

10.4.11, powerpc-apple-darwin8-gcc-4.0.1. weak_function returns void.


Kind regards,

Gerriet.

_______________________________________________

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


  • Prev by Date: NSOutlineView / NSSplitView redraw delay
  • Next by Date: How to interrupt a long loop with command-period?
  • Previous by thread: Re: NSOutlineView / NSSplitView redraw delay
  • Next by thread: Re: weak linking
  • Index(es):
    • Date
    • Thread