• 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: Carbon-Cocoa Integration: Linking issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Carbon-Cocoa Integration: Linking issue


  • Subject: Re: Carbon-Cocoa Integration: Linking issue
  • From: Eric Schlegel <email@hidden>
  • Date: Tue, 22 Jan 2008 09:39:31 -0800


On Jan 21, 2008, at 6:48 PM, Aaron Vegh wrote:

5. However, when I make a call to my own class in the Cocoa app, I get
the following error:

ld: duplicate symbol .objc_class_name_MyController in
/Users/aaron/Developer/MyApp/build/MyApp.build/Release/ MyAppPlugin.build/Objects-normal/ppc/MyAppPlugin.o
and /Users/aaron/Developer/MyApp/build/MyApp.build/Release/ MyAppPlugin.build/Objects-normal/ppc/MyController.o


In XCode, I've included MyController.m in the Build target (all kinds
of errors result otherwise). The Cocoa function is pretty simple:

void sendPathToMyApp (char *path) {
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
	NSString *thePath = [NSString stringWithCString:path
								encoding:NSUTF8StringEncoding];
	MyController *newMyController = [[MyController alloc] init];
	NSLog(@"Handed the path %@", thePath);
	[newMyController showWindow:nil];
	[newMyController setThePath:thePath];
	[pool release];
} /*sendPathToMyApp*/

I think you have a fundamental issue here that is beyond the linking problem. It appears that you're expecting your contextual menu plugin to be able to access an instance of your MyController class from your Cocoa application - is that right? i.e., your CM plugin is attempting to send a message to MyController in order to pass info from the plugin to your app?


If that's what you're doing, then it won't work. The CM plugin is running inside the Finder process. Your Cocoa application is an entirely separate process. The two do not share the same instances of your controller class and you can't just instantiate MyController in your plugin and use it to pass data to your Cocoa app.

You will need to use a different architecture for passing data to your Cocoa app - for example, distributed objects, or AppleEvents, or some other form of IPC.

-eric

_______________________________________________

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: Carbon-Cocoa Integration: Linking issue
      • From: "Aaron Vegh" <email@hidden>
References: 
 >Carbon-Cocoa Integration: Linking issue (From: "Aaron Vegh" <email@hidden>)

  • Prev by Date: Re: Understanding the inner workings: getting to know how functions are called
  • Next by Date: Re: NSAppleEventDescriptor - getting a double (and other animals)
  • Previous by thread: Re: Carbon-Cocoa Integration: Linking issue
  • Next by thread: Re: Carbon-Cocoa Integration: Linking issue
  • Index(es):
    • Date
    • Thread