Search code examples
c++eclipsenpapi

how to add .rc file to a project in eclipse


I need to add a .rc file and corresponding resource.h to existing c++ project using eclipse. It seems that there aren’t many materials about this. How to do it? OR How to make a plugin to be detected by Firefox? (given the .so file has been generated successfully)

(The project is the npruntime example of NPAPI from Mozilla.)


Solution

  • Assuming that you're on linux/unix, which it sounds like, there are no .rc things that need to be done to let the browser detect it, you just need to expose the correct entrypoints and respond to them intelligently.

    For example, FireBreath exposes these entrypoints:

    extern "C" char * NP_GetPluginVersion()
    extern "C" const char * NP_GetMIMEDescription()
    extern "C" NPError NP_GetValue(void *future, NPPVariable variable, void *value)
    extern "C" NPError NP_Initialize(NPNetscapeFuncs* pFuncs, NPPluginFuncs *pluginFuncs)
    extern "C" NPError NP_Shutdown()
    

    See also http://npapi.com/tutorial