Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strategies to prevent class name clashes




On 15.02.2008, at 13:35, Arne Scheffler wrote:

No, dyld as of Mac OS X 10.2 supports two-level namespaces. Otherwise AudioUnits and VST plug-ins wouldn't work on Mac OS X. As an example every VST plug-in just exports one C function and yet I haven't heard of a host only be able to load one VST plug-in.

OK, with two level namespaces that is partially resolved.


I think what you mean is if some one tries to load a dylib and there's already a dylib with the same name in the process, than you're right it only loads the first one.

IIRC the symbol resolution is applicable to referenced symbols, but not to bundle entry points.


With Objective-C now this won't work anymore.

Certainly not. If I understood it correctly, objc_lookUpClass does not know the concept of namespaces, and classes get added at bundle load time to the internal class lookup table.


[[foo alloc] init];

is AFAIK (not sure 'bout the SEL lookup..) equivalent to

id aClass = objc_getClass( "foo" ); // NO NAMESPACES HERE - plain ASCII class name!!!!
id anObject = objc_msgSend( aClass, sel_getUid( "alloc") );
objc_msgSend( anObject, sel_getUid( "init") );


How does framework versioning work for Cocoa ? If one plug-in got compiled with say version 1 and another got compiled with version 2. Will they both work ?

You´re right: it won't work.

How is that possible as Objective-C only allows one class with the same name ?


See above. The Objective-C runtime reference is pretty enlightening by revealing some implementation details, the "Code loading programming topics for Cocoa" contains some more clarifications...


Regards,
	Tom_E
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Strategies to prevent class name clashes (From: Arne Scheffler <email@hidden>)
 >Re: Strategies to prevent class name clashes (From: Lieven Dekeyser <email@hidden>)
 >Re: Strategies to prevent class name clashes (From: Uli Kusterer <email@hidden>)
 >Re: Strategies to prevent class name clashes (From: Arne Scheffler <email@hidden>)
 >Re: Strategies to prevent class name clashes (From: Thomas Engelmeier <email@hidden>)
 >Re: Strategies to prevent class name clashes (From: Arne Scheffler <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.