tags:

views:

561

answers:

1

Hi,

I have written a NPAPI plugin in C which needs to call the NPN_Invoke function (in order to call a JavaScript function).

But NPN_Invoke() takes the NPP instance as a parameter.

Only the NP_New() and NP_Destroy() functions get passed NPP instance. How do I get this NPP instance?

Thanks in advance.

+1  A: 

In the NP_GetEntryPoints define your own NP_yourNew Function, Now when the after the NP_New the framework calls your NP_yourNew with the instance. The instance could be saved when the your callback just gets invoked.

atVelu
You can find good examples of this in the mozilla codebase, under: mozilla-central/modules/plugin/sdk/samples/npruntime. You could also check out the FireBreath project (http://firebreath.googlecode.com) for an example of a fully-implemented plugin framework. Start in np_winmain.cpp in one of the example projects and look at the src/NpapiPlugin project
Taxilian