Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: jsibarani on July 25, 2007, 02:55:32 pm

Title: PluginRegistrant
Post by: jsibarani on July 25, 2007, 02:55:32 pm
Hi.

In PluginRegistrant's constructor, there is RegisterPlugin()

Code
        PluginRegistrant(const wxString& name)
        {
            Manager::Get()->GetPluginManager()->RegisterPlugin(name, // plugin's name
                                                                &CreatePlugin, // creation
                                                                &FreePlugin, // destruction
                                                                &SDKVersion); // SDK version
        }

I noticed that LoadPlugin() will triggered the call to RegisterPlugin(),but
which part of Code::Blocks is calling RegisterPlugin() ?

It's very confusing for me, because
Code
   namespace
   {
       PluginRegistrant<MyPlugin> registration("MyPlugin");
   }
is inside a plugins' dll.


i'm sorry for my ignorant and my bad english.
 :)
Title: Re: PluginRegistrant
Post by: TDragon on July 26, 2007, 12:53:46 am
RegisterPlugin() is called from the PluginRegistrant constructor (as you noticed), when the plugin DLL is loaded and the templated global PluginRegistrant object for that plugin is created.
Title: Re: PluginRegistrant
Post by: jsibarani on July 27, 2007, 07:31:03 am
Thanks ,T.