views:

701

answers:

1

Hi,

I've got some code that lies in a browser, and wrote C++ plugins for both IE (COM/ActiveX) and firefox (NPAPI).

I now have to get this code work on Mac OS X. I found some input on apple's site, but it's written in Objective C.

I also read about SIMBL, but it seems to deal with Objective C code only, isn't it?

So here are my questions:

  • Is it possible to code a pure C++ plugin for Safari (re-using my Firefox NPAPI plugin would be great)?

  • If it's not possible, is there a way to use an objective C plugin as a loader for some C++ code?

I'm a total noob on Mac OS, and don't even have a Mac Box to mess around, hence the very generic question.

Thanks

+6  A: 

The NPAPI plugin mechanism is the standard mechanism for browser plugins on MacOS (and linux -- everything other than IE really) -- if you use the NPAPI your plugin will work on Safari, Firefox, and Opera. They will also work in both 32 and 64-bit Safari. Assuming your code makes no assumptions about what browser it's running in the same NPAPI-code should work in all browsers (i've seen "NPAPI" plugins that dynamically resolve XUL related functions in the blind faith that NPAPI is used only by Firefox, despite it being the standard plugin format for more or less every non-IE browser).

"Plugins" like SIMBL misuse MacOS APIs designed for a distinct (but important) purpose to arbitrarily inject their own code into the Safari address space -- when people use these (being mislead into believing it's safe) Safari becomes substantially less stable, and frequently stops working after major updates (in an extreme case the Leopard "blue screen of death" was because of logitech using APE to do something similar to SIMBL).

olliej
Well, thanks a lot for your answers, glad I'd be able to recycle my NPAPI plugins.
Vinzz