When using the Introjucer tool, which Project Type should I use to create a new stub solution for a browser plug-in? Dynamic Library?
Yes, it's a DLL.
I'm a bit confused on what files I really need in order to build a browser plugin (NPAPI).
The 'how to build a browser plugin.txt' does provide some guidance, but I still have a few questions...
Building a Windows NPAPI plugin in Visual Studio
- Create a new project to build a win32 DLL -- DONE I used the introjucer to make a win32 dll project.
- Add the juce wrapper source files to the project (have a look at the demo project to
find out which files this includes). -- This step has me a bit confused (see below)
- To include the BrowserPluginCharacteristics.h file, you may need to add an include path to wherever this
file lives in your project. -- Easy enough I was just going to put this .h file in my source folder.
The format of the demo browser plug-in project (VS) is significantly different than projects generated from the Introjucer (or even the JuceDemo project). Do I need to manually copy the modules\juce_browser_plugin_client folder into my new dll project and add an entry to generated appconfig.h? Or do I just need to manually copy the modules\juce_browser_plugin_client\wrapper folder?
Again, looking at the files in the demo plug-in project, there seems to be a mix of files (wrapper stuff as well as .cpp files that include 'modules') and neither of the usual "Juce Library Code", "Juce Modules" folders/sub-folders that Introjucer and the JuceDemo project leverage.
Using the JuceBrowserPluginDemo project as a template (which is a bit difficult as it obviously wasn't introjucer generated), I've tried the following:
- Manually copied <downloaded juce source>\...\modules\juce_browser_plugin_client folder into <my project folder>\JuceLibraryCode\...
- In my Introjucer generated dll project, I added the following two lines to my JuceLibraryCode\JuceHeader.h file
#include "AppConfig.h" #include "BrowserPluginCharacteristics.h" // ADDED ... #include "modules/juce_video/juce_video.h" #include "modules/juce_browser_plugin_client/juce_browser_plugin.h" // ADDED
- Added BrowserPluginCharacteristics.h to my Source folder.
Now it compiles, but I get link errors (missing BrowserPluginComponent and ~BrowserPluginComponent).
error LNK2019: unresolved external symbol "public: virtual __thiscall juce::BrowserPluginComponent::~BrowserPluginComponent(void)" (??1BrowserPluginComponent@juce@@UAE@XZ) referenced in function __unwindfunclet$??0npMyBrowserPlugIn@@QAE@XZ$0 error LNK2019: unresolved external symbol "public: __thiscall juce::BrowserPluginComponent::BrowserPluginComponent(void)" (??0BrowserPluginComponent@juce@@QAE@XZ) referenced in function "public: __thiscall npMyBrowserPlugIn::npMyBrowserPlugIn(void)" (??0npMyBrowserPlugIn@@QAE@XZ)
I thought by including the modules/juce_browser_plugin_client I would have resolved both my complier (missing BrowsePluginComponent) as well as any outstanding linker issues, any ideas?
I think I figured out the link issue.
After I manually copied the modules\juce_browser_plugin_client folder to my project's folders, I forgot to add juce_browser_plugin.cpp to the project's JuceLibraryCode folder (as an exisiting item). An obvious mistake, not sure why I did't figure that out sooner.
Once I made those changes to the project, I had to undo my addition of --#include "BrowserPluginCharacteristics.h"-- from my JuceHeader.h that I mentioned above and, instead, place it into my AppConfig.h within the "you can insert stuff here" block like this...
// [BEGIN_USER_CODE_SECTION] // (You can add your own code in this section, and the Introjucer will not overwrite it) #include "BrowserPluginCharacteristics.h" // [END_USER_CODE_SECTION]
I also had to add <project folder>\Source to my project's include search path so the compiler could find my BrowserPluginCharacteristics.h file that I placed into that folder.
So, now it builds. I'll let you know if I get it to work.