PDA

View Full Version : Doing COM-ish things in OSX




DannySmurf
Oct 17, 2005, 10:38 AM
Hey guys. This is a question for all the advanced Mac programmers here. I bought Synergy (http://wincent.com/a/products/synergy-classic/) a while ago and it got me wondering how programs like this work. For those who don't know, Synergy controls iTunes from a little spot in the menu bar.

Of course, on Windows you'd do this through COM, but how is it done in OSX? Does each applciation need to expose some sort of IPC interface by itself for this kind of control to happen? Or is there something built into the OS?



gekko513
Oct 17, 2005, 10:58 AM
I just browsed quickly through the developer reference for Interapplication Communication (http://developer.apple.com/referencelibrary/Cocoa/idxInterapplicationCommunication-date.html) using Cocoa, and there seems to be a number of techniques available. XML-RPC and Soap, Distributed Objects and System Services. NSDistributedNotificationCenter also lets you send messages between tasks.

robbieduncan
Oct 17, 2005, 11:17 AM
Hey guys. This is a question for all the advanced Mac programmers here. I bought Synergy (http://wincent.com/a/products/synergy-classic/) a while ago and it got me wondering how programs like this work. For those who don't know, Synergy controls iTunes from a little spot in the menu bar.

Of course, on Windows you'd do this through COM, but how is it done in OSX? Does each applciation need to expose some sort of IPC interface by itself for this kind of control to happen? Or is there something built into the OS?

Probably via AppleScript.

csubear
Oct 17, 2005, 12:59 PM
There is nothing like COM on OS-X.

COM on windows solves two problems

a) Late bound objects
b) RPC/IPC

OS X solves these problems diffrently

a) Obj-C
b) SOAP/XML-RPC/Traditional Unix IPC/Cocoa Notification Center

(edit)

And yes most stuff like that is done with apple script hooks exposed by the application.

Fukui
Oct 17, 2005, 02:13 PM
There is nothing like COM on OS-X.

COM on windows solves two problems

a) Late bound objects
b) RPC/IPC

OS X solves these problems diffrently

a) Obj-C
b) SOAP/XML-RPC/Traditional Unix IPC/Cocoa Notification Center

(edit)

And yes most stuff like that is done with apple script hooks exposed by the application.
Right, but dont forget they changed (united) the plug-in system under OS X to use a COM interface so that carbon and cocoa could use plugins from windows and vice-versa.

csubear
Oct 17, 2005, 02:38 PM
Right, but dont forget they changed (united) the plug-in system under OS X to use a COM interface so that carbon and cocoa could use plugins from windows and vice-versa.


??, not sure what you mean.

robbieduncan
Oct 18, 2005, 04:20 AM
Right, but dont forget they changed (united) the plug-in system under OS X to use a COM interface so that carbon and cocoa could use plugins from windows and vice-versa.

Can you post some documentation or examples of this? I'm fairly sure there is no generic plugins mechanism at all, it's up to the App developer to provide (beyond the system provided CFBundle/NSBundle help). Are you talking about a specific app?

Fukui
Oct 18, 2005, 04:32 AM
??, not sure what you mean.
http://www.macdevcenter.com (http://www.macdevcenter.com/pub/a/mac/2004/04/16/com_osx.html?page=1)

There was another article somewhere burried at apple.com (or maybe a cocoa text-book) about cross-platform plugins using CFPlugin and COM, but basically even cocoa apps now use CFPlugin AFAIKR.