Dll support: testers needed

Benjamin Thaut code at benjamin-thaut.de
Tue Jan 9 08:10:56 UTC 2018


Am 09.01.2018 um 05:19 schrieb Dylan Graham:
> It's pretty basic but I'm glad it works. I'll try doing something more 
> advanced.

Hi Dylan,

I'm glad that it works for you. I'm curios though, why are you using an 
import library for your plugin? Normally plugins are build without and 
import library (the -L/IMPLIB parameter) and then loaded dynamically 
through LoadLibrary by your main executable. This way you can add/remove 
plugins without the need to recompile your main executable. Usually such 
plugin systems are done like this:

You have some common library that defines shared functionality and the 
base interfaces such as a Plugin base class or Plugin interface. This 
common library is build into a dll with import library.

You have one ore multiple plugins that link against the common library 
and implement the plugin interface / plugin base class. Each of these 
plugins provides a function "getPluginImpl" or something along the lines 
which can be used to get an instance of the Plugin implementation.

You have the main executable, which links against the common library. It 
dynamically loads the plugin.dlls and calls the getPluginImpl method on 
them to retrieve the implementation. No import library involved here.

What your doing is also a valid use case. It is usually done when link 
times get to long or if you want to have clean interface between the 
different subsystems in your application. Your codebase is usually split 
into multiple dlls each with a import library which are then all used by 
the main executable.

-- 
Kind Regards
Benjamin Thaut


More information about the Digitalmars-d mailing list