I'm writing a browser plugin for OS X Lion that needs to be able to call JavaScript functions back on the page. The only way I know how to do that is using WebKit/npruntime functions like NPN_Invoke
. Unfortunately, these functions are not available to a 64-bit environment like Lion. Is there an alternative way to call JavaScript from a plugin? Thanks.
Asked
Active
Viewed 305 times
0

Drew C
- 6,408
- 3
- 39
- 50
-
3What makes you say that NPN_Invoke isn't available in a 64-bit plugin? Also, keep in mind that you can still have a 32-bit only plugin on Lion; I'm not aware of any browser for the Mac that has a 64-bit mode that can't still run 32-bit plugins. – smorgan Jun 05 '12 at 17:20
-
Because I get linker errors for all my npruntime functions stating ld: symbol(s) not found for architecture x86_64 – Drew C Jun 05 '12 at 17:49
-
2You don't link against them, you get a function table containing them from the browser via [`NP_Initialize()`](https://developer.mozilla.org/en/NP_Initialize) - same as for i386. – Georg Fritzsche Jun 05 '12 at 19:32
-
1Yeah; the premise of your question is incorrect. NPAPI in 64 bit is the same as 32 bit, and as stated by others 64 bit browsers on Mac can all use 32 bit plugins anyway. See http://npapi.com/tutorial for a discussion of the function table that gives you those functions; you can create wrappers that actually call those function pointers yourself if you want. – taxilian Jun 05 '12 at 19:54
-
Thanks folks. The code I was looking at for a model was using some sneaky macro trickery to make it look like he was calling those functions directly. Between your comments and the answer linked below I got it written correctly. Thanks again. http://stackoverflow.com/questions/7308036/firefox-npapi-xcode-link-errors – Drew C Jun 06 '12 at 16:52