Search code examples
cpluginsnpapi

How to get the NPP Instance inside a NPAPI C plugin


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.


Solution

  • 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.