Author Topic: Cross-platform Pulgin Framework  (Read 8612 times)

Anonymous

  • Guest
Cross-platform Pulgin Framework
« on: July 07, 2005, 08:16:16 pm »
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

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Cross-platform Pulgin Framework
« Reply #1 on: July 07, 2005, 08:38:55 pm »
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.
Be patient!
This bug will be fixed soon...

per_eckerdal

  • Guest
Cross-platform Pulgin Framework
« Reply #2 on: July 07, 2005, 09:06:26 pm »
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

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Cross-platform Pulgin Framework
« Reply #3 on: July 07, 2005, 09:10:01 pm »
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


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

Yiannis.
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Cross-platform Pulgin Framework
« Reply #4 on: July 07, 2005, 09:12:31 pm »
@Guest: I forgot to point you to the Code::Blocks HelloWorld plugin tutorial :)

Yiannis.
Be patient!
This bug will be fixed soon...

per_eckerdal

  • Guest
Cross-platform Pulgin Framework
« Reply #5 on: July 07, 2005, 09:13:46 pm »
That was kinda the point: Code::Blocks plugin help .zip..
:D
/Per Eckerdal

Anonymous

  • Guest
Cross-platform Pulgin Framework
« Reply #6 on: July 07, 2005, 09:26:17 pm »
Thanks for the quick replys!

/Per Eckerdal: I may start a cross platform plugin bassed app, im not too sure yet. It's for my major university project so still need to think of some other ideas. One thing is for sure though, i'll use Code::Blocks as my IDE :)

I'll take a look at the linked docs, and if i have any other questions i'll be sure to stop back here.

Cheers
Jon Cade