Re: Carbon-Cocoa Integration: Linking issue
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