jBlog

Home page > Miscellaneous > C++ Plugins loading - Step 1

C++ Plugins loading - Step 1

Sunday 15 November 2009, by Jean-Baptiste Le Stang

I’ve written a simple application in C++ that will loads dynamic libraries (called in our case bundles):
- one bundle can publish several services
- the applications loads every bundles
- every bundles registers the list of services they provide
- every bundle gives the list of services they are expecting.

Every bundle interested by a service will be notified when the service is loaded. No matter what the load order is.

In order to achieve the plugin loading, each library must implements the following method (I’ve a Macro that will generate the required code : DeclareBundle(t) in interfaces.h)

Bundle * BundleLoader(){ return new BundleOfTheLibrary();}

The project is actually a Xcode project, creating a make file is left as an exercice ...

The application is really simple and does not handles error cases :p this will be done in step 2 :p

Zip - 24.2 kb

Reply to this article

SPIP | template | | Site Map | Follow-up of the site's activity RSS 2.0