Reputation: 137
I got my header files from: http://code.google.com/p/npapi-sdk/source/browse/?r=7#svn%2Fwiki
So in the Initialize method, I stored a pointer to all of the browser NPN methods like so
static NPNetscapeFuncs* browser;
NPError NP_Initialize(NPNetscapeFuncs* browserFuncs)
{
/* Save the browser function table. */
browser = browserFuncs;
return NPERR_NO_ERROR;
}
When I am creating my NPClass struct, should I just assign it the already existing browser functions like this:
struct NPClass class;
class.hasMethod = browser-> hasmethod;
etc.
Or do I need to implement the functions in the npruntimeheader using the browser funcs and assign them to the class that way. Example: class.hasMethod = NPN_HasMethod;
And then implement the function below:
bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName)
{
return browser->hasmethod(npp, npobj, methodName);
}
Or are the NPN functions in the runtime header already implemented somehow?
I need to write this in c, and I don't think using firebreath would be a great idea for this particular project. Thanks in advance for your help
Upvotes: 0
Views: 458
Reputation: 98994
You need to implement the functions for your NPClass
es yourself, they define the behaviour of your scriptable objects. Part three of taxilians NPAPI tutorial covers this.
The functions that you receive via the browser
function table are for calling into the browser (and already implemented there), e.g. to get information about NPObject
s with hasmethod
etc.
However the function declarations like NPN_HasMethod()
need to be implemented by you if you want to use them, at their simplest just calling the corresponding functions in browser
as you have shown with HasMethod()
.
Upvotes: 1