On Tuesday, 9 January 2018 at 08:10:56 UTC, Benjamin Thaut wrote:
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.
In all honesty, I'm not sure. I saw the instructions on your
website and just adapted it.
Also, please excuse me, I'm fairly new to compiling native
programs. I've been using DUB this entire time.
With the common library (plugin base) DLL don't I need to
generate a .lib for plugin implementations to compile/link
against?
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.
Check. I'm doing that.
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.
I'm doing that but the getPluginImpl call is done in the common
library. The executable is only a bootstrap.
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.
I am doing that. I don't need to recompile anything. I can add as
many plugin implementations without recompiling the common
library/executable.