views:

19

answers:

2

I have a cocoa application which has certain subroutines / methods. So if I have a method like this:

- (void) dummyMethod:(NSObject*)dummy
{
 //code
}

Can I call it from an outside application providing I have the correct headers? I mean linking an application with another application. That method is an instance method by the way.

Sorry if that sounds absurd.

+1  A: 

You can not call method from another application (process). You can call methods of framework,static or dynamic library.
To call method on another application you have to use interprocess communication mechanism. In cocoa you can achieve this by using Distributed notification.

Devara Gudda
I just thought that could be easier than using MIG subsystems.
Nick Brooks
Worth pointing out that for IPC, the receiver has to be listening for your call—you can't just call random things in the receiver, and you can't just post random distributed notifications and expect something to happen. Also, distributed notifications are session-wide, not targeted, so if any processes are listening for the notification, the notification will hit all of them.
Peter Hosey
+2  A: 

Have a look at ScriptingBridge framework that allows different applications to communicate with each other - may that's what you need.

Vladimir