<p>Could someone write-up a step by step guide to developing a C++ based plugin for FireFox on Windows?  </p>

<p>The links and examples on <a href="http://www.mozilla.org/projects/plugins/" rel="nofollow noreferrer">http://www.mozilla.org/projects/plugins/</a> are all old and inaccurate - the "NEW" link was added to the page in 2004.</p>

<p>The example could be anything, but I was thinking a plugin that lets JavaScript set the name and then displays "Hello {Name}".  To show 2-way communication, it could have a property that returns the full salutation.</p>

<p>Though not as important, it would be nice if the plugin would work in Chrome too.</p>

[{'answer_id': 69239, 'author': 'Ben Combee', 'author_id': 1323, 'author_profile': 'https://Stackoverflow.com/users/1323', 'pm_score': 2, 'selected': False, 'text': '<p>It\'s fairly simple to make a plugin using NPAPI.  The key header files you\'ll need from the Gecko distribution are npapi.h and npupp.h.  You\'ll export functions from your plugin DLL or shared library with the names NP_Initialize, NP_Shutdown, NP_GetMIMEDescription, and NP_GetValue, and you\'ll need to also fill in the symbol table given to you in the NP_Initialize call with handlers for all of the NPP functions.</p>\n\n<p>The key functions to implement from that set are NPP_New and NPP_Destroy.  Those define the lifecycle of a plugin instance.  If you\'re going to handle a media file linked from an &lt;object> or &lt;embed>, you\'ll need to also deal with NPP_NewStream, NPP_WriteReady, NPP_Write, and NPP_DestroyStream as a way for your plugin to get the file\'s data from the browser.  There\'s plenty more in <a href="http://developer.mozilla.org/en/Gecko_Plugin_API_Reference" rel="nofollow noreferrer">the Gecko Plugin developer\'s guide</a>.</p>\n'}, {'answer_id': 70751, 'author': 'Nickolay', 'author_id': 1026, 'author_profile': 'https://Stackoverflow.com/users/1026', 'pm_score': 4, 'selected': True, 'text': '<p>See also <a href="http://developer.mozilla.org/en/Plugins" rel="nofollow noreferrer">http://developer.mozilla.org/en/Plugins</a> . And yes, NPAPI plugins should work in Google Chrome as well.</p>\n\n<p>[edit 2015: Chrome removes support for NPAPI soon <a href="http://blog.chromium.org/2014/11/the-final-countdown-for-npapi.html" rel="nofollow noreferrer">http://blog.chromium.org/2014/11/the-final-countdown-for-npapi.html</a> ]</p>\n'}, {'answer_id': 1065553, 'author': 'Charles Dietrich', 'author_id': 131284, 'author_profile': 'https://Stackoverflow.com/users/131284', 'pm_score': 2, 'selected': False, 'text': '<p>Check out Nixysa <a href="http://code.google.com/p/nixysa/" rel="nofollow noreferrer">http://code.google.com/p/nixysa/</a>. I tried to build the samples in the Mozilla SDK but they were hard to build. The Nixysa sample is easy to build. Plus the code is much neater than directly using NPAPI. The only drawback is that as of today Nixysa is not well documented. I have a Nixysa sample that implements callbacks if you want it (I do plan on submitting a patch to Nixysa when I get around to it).</p>\n'}, {'answer_id': 1935141, 'author': 'taxilian', 'author_id': 229998, 'author_profile': 'https://Stackoverflow.com/users/229998', 'pm_score': 3, 'selected': False, 'text': '<p>If you need something that works cross-browser (firefox and ie), you could look at firebreath: <a href="http://www.firebreath.org" rel="nofollow noreferrer">http://www.firebreath.org</a></p>\n\n<p>For general "how to build a npapi plugin on windows" information, I have a few blog posts on the subject (linked to from some of the above sources as well)</p>\n\n<p><a href="http://colonelpanic.net/2009/03/building-a-firefox-plugin-part-one/" rel="nofollow noreferrer">http://colonelpanic.net/2009/03/building-a-firefox-plugin-part-one/</a></p>\n\n<p>I really recommend firebreath, however, since we created it exactly for people who don\'t have time to do the months (literally) of research that it took us to figure out how it all works.  If you don\'t want to use it as a basis for your plugin, though, you can still find a lot of good example code there.</p>\n\n<p>should work on chrome, firefox, and safari on windows too! =]</p>\n\n<p>good luck!</p>\n'}]
['https://Stackoverflow.com/questions/62977', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7425/']