Skip navigation.
 
mlRe: Carbon-Cocoa Integration: Linking issue
FROM : Eric Schlegel
DATE : Tue Jan 22 18:39:31 2008

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

Related mailsAuthorDate
mlCarbon-Cocoa Integration: Linking issue Aaron Vegh Jan 22, 03:48
mlRe: Carbon-Cocoa Integration: Linking issue Kyle Sluder Jan 22, 04:00
mlRe: Carbon-Cocoa Integration: Linking issue Shripada Hebbar Jan 22, 05:09
mlRe: Carbon-Cocoa Integration: Linking issue Aaron Vegh Jan 22, 05:23
mlRe: Carbon-Cocoa Integration: Linking issue Shripada Hebbar Jan 22, 05:40
mlRe: Carbon-Cocoa Integration: Linking issue Aaron Vegh Jan 22, 13:20
mlRe: Carbon-Cocoa Integration: Linking issue Eric Schlegel Jan 22, 18:39
mlRe: Carbon-Cocoa Integration: Linking issue Aaron Vegh Jan 22, 20:48