Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

angry

supporting plug-ins?

This topic is 5486 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im gonna write this program, and I would want it to support plugins. However Im unsure of how this works, like the photoshop filters, are they made in a scripting language which photoshop understands? Oh and by the way, do you know of a library like MFC, but multiplatform? (which is free) /thanks [edited by - angry on June 18, 2003 3:50:45 PM]

Share this post


Link to post
Share on other sites
Advertisement
There is no "correct" way of supporting plugins - however I use two approaches - the first is to develop a standard interface for plugins - mine is a class named IPluginInterface (orginal ) anyway this is just a class definition that contains nothing but pure virtual functions this is where a class defines a function interfac but does not implement it - a class derived from this class must implement it. For example:


class IPluginInterface
{
...
virtual bool Execute()=0;
};


you cannot directly create a class like this, but you then overwrite this :


class CMyStupidPlugin: public IPluginInterface
{
...
bool Execute();
};


implementation:

bool CMyStupidPlugin::Execute()
{
....
}

Anyway you write the plugin in a dll and load it dynamically during runtime. The DLL will have to support a function to create an instance of its IPluginInterface derived class
something like

IPluginInterface* CreatePlugin();

when this function is run - it should return a pointer to its derived class and the application can use it, agaiin for our example plugin the CreatePlugin function would look like :

IPluginInterface* CreatePlugin()
{
return((IPluginInterface*) new CStupidPlugin());
}

this is using a shared interface betweem your application and plugin dll allowing them to talk to each other through it.

If you want a major in depth explanation just post a reply - and btw i am tired so there are probably lots of errors in this

Share this post


Link to post
Share on other sites
thanks alot... however me and dll''s are not best friends, however there is aid for that.. Another thing thats bugging me with dll''s is that they aren''t multi-platform, right?

However, converting dll''s to another OS dll-type might not be so hard?

Share this post


Link to post
Share on other sites
all you have to do is change the code which interfaces the dll with the program to be the correct code for the platform, the rest of the code shouldnt have to change.

Another option, is to use a scripting language interupter built into your program and have the scripts written in that language and loaded by your app. The script could also load and call i dll as well if needed i guess

Either way you''d probably have to provide hooks of some type into the plugin system to allow the code to do something with your program from the dll or script.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!