In my VS2010 DLL project i have an error, when compiling this project: LNK 2001 unresolved external on pFuncs
member of my class:
class Foo
{
// ...
static NPPluginFuncs * pFuncs;
// ...
};
Here a struct, defined in npfunctions.h:
typedef struct _NPPluginFuncs {
uint16_t size;
uint16_t version;
NPP_NewProcPtr newp;
NPP_DestroyProcPtr destroy;
NPP_SetWindowProcPtr setwindow;
NPP_NewStreamProcPtr newstream;
NPP_DestroyStreamProcPtr destroystream;
NPP_StreamAsFileProcPtr asfile;
NPP_WriteReadyProcPtr writeready;
NPP_WriteProcPtr write;
NPP_PrintProcPtr print;
NPP_HandleEventProcPtr event;
NPP_URLNotifyProcPtr urlnotify;
void* javaClass;
NPP_GetValueProcPtr getvalue;
NPP_SetValueProcPtr setvalue;
NPP_GotFocusPtr gotfocus;
NPP_LostFocusPtr lostfocus;
NPP_URLRedirectNotifyPtr urlredirectnotify;
NPP_ClearSiteDataPtr clearsitedata;
NPP_GetSitesWithDataPtr getsiteswithdata;
NPP_DidCompositePtr didComposite;
} NPPluginFuncs;
Static members of a struct (or class) are declared in the typedef struct { };
and needs to be defined explicitly once:
#include "npfunctions.h"
Foo::pFuncs = NULL; // optional initialization
int main()
{
Foo::pFuncs = new NPPluginFuncs;
}