Dynamic loading/plugins

General help with the eC language.
Post Reply
Posts: 5
Joined: Tue Apr 16, 2013 11:40 pm

Dynamic loading/plugins

Post by Heiko »


i am new to eC and i am trying make a application where i deliver a binary which is the application and allow the users to extend the application by making 'plugins' that are loaded dynamically on application start.

would this be possible with eC?
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Dynamic loading/plugins

Post by jerome »

Hi Heiko!

Welcome to eC! This is totally possible, and made easy.

The plugins projects must be set up as dynamic library (.dll/.so/.dylib).
Say you would like to load all plugins from a folder, you can use the FileListing class to iterate through the files in a folder, and load them with eModule_Load(), e.g. if the plugin is called myplugin.dll/libmyplugin.so/libmyplugin.dylib :

Code: Select all

Module module = eModule_Load(__thisModule, "myplugin", publicAccess);
This will give you a module handle, from which you can find a class and instantiate it:

Code: Select all

Class c = eSystem_FindClass(module, "MyPluginClass");
A common approach would be to define a base class with virtual methods in the application, which your plugin class can derive from and override the methods it wants to implement.

Please let me know if you have more questions regarding this after you try it out. Good luck!

Best regards,

Post Reply