User forums > General (but related to Code::Blocks)

Cross-platform Pulgin Framework

(1/2) > >>

Anonymous:
Hello.

I'm new to this board and application but i have to say i have found Code::Blocks really nice to use.

I am interested in how the cross-platform plugin framework was developed. I have had a quick look through the source code, but unfortunatly i am finding some of it difficult to understand. Could somone please provide me with a brief overview of how the plugin manager works?

Many Thanks,
Jon Cade

mandrav:
Sure.

It scans the plugins dir and tries to load any dll/so (aka plugins) it finds in there.
For each one of them it hooks to the entry point, an exported function ingeniously named GetPlugin(), whose only duty is to construct and return the plugin contained in the library.
Plugins are kept in a container and participate in the event handling chain of the application.
You should take a look at pluginmanager.h and cbplugin.h (it's documented).

That's it, roughly.
If you have something more specific to ask, go ahead ;)

Yiannis.

per_eckerdal:
Are you interested in creating you own cross-platform application that uses plugins?
If that is the case, you can take a look at this: http://www.shell.linux.se/edev/files/cbpluginhelp.zip (Sorry it's Dev-C++, but that was before i knew of Code::Blocks..)
It is a awfully slow and bad implementation of a plugin system, but it works :). It is designed to be cross-platform but only windows is implemented. To port it to posix, you should replace LoadLibrary with dlopen, FreeLibrary with dlclose and GetProcAddress with dlsym.

One important thing, that I have forgotten in this simple system, is that you will need to delete the plugin from the plugin dll, because the application and the plugin may use different memory allocation routines (if you compiled with another compiler, for example) otherwise you can get REALLY annoying errors.
/Per Eckerdal

mandrav:

--- Quote from: per_eckerdal ---If that is the case, you can take a look at this: http://www.shell.linux.se/edev/files/[b]cb[/b]pluginhelp.zip
--- End quote ---


Hehe, that's funny Per:
cbpluginhelp.zip ?  :lol:
(we use cb for abbreviating Code::Blocks)

Yiannis.

mandrav:
@Guest: I forgot to point you to the Code::Blocks HelloWorld plugin tutorial :)

Yiannis.

Navigation

[0] Message Index

[#] Next page

Go to full version