Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
retoor82633dYou share this because recreational coding gives mood a good boost in general. Every little issue that you resolve, you'll get a bit happier until you start posting high on devRant like I do.
-
What is your approach to stable ABI? pure virtual classes, serialization to C ABI, or some interesting mix?
-
Rust doesn't have a very good equivalent to C++'s pure virtual ABI, so I load plugins as child processes and communicate via IPC.
-
@lorentz
I had some major issues with the vtable though. Apparently I fucked up somehow and fixed it by using the appropriate compiler flags and using RTLD_GLOBAL in my dlopen call. Kind of a hassle to understand some things but eh.
Related Rants
-
Eventyret9
When you release your first plugin for vscode and you just see it grows and grows yeserday was 350 downloads a...
-
deletescape1
This is what eclipse windowbuilder just told me
-
olback18
I can't believe that something I threw together in an afternoon to make my work flow better turned into someth...
I've started messing with C++ again, and it's kinda fun :)
I'm a fan of modular systems, so I've decided to build a little proof of concept for plugin loading.
A plugin is basically just a shared library which exposes a class that extends the Plugin abstract class and implements some lifecycle methods.
Then a plugin file has a system specific PLUGIN_EXPORT create_plugin()... function that just returns an instance of the plugin.
I've decided to use a super simple event bus for communicating from the host system to the plugin and vice versa, it's supplied in a PluginContext class which is supplied to the plugin upon initialisation.
Loading the plugins is done via LoadLibraryA(...) or dlopen(...).
Of course I'm freeing/closing them again at the end of the host system lifecycle. I hope to eventually implement some form of HMR.
Idunno why I'm sharing this; The system has zero purpose other than learning, but I've figured that implementing plugins in a "lower" level language, rather than typescript with node is more fun :)
random
plugin
shared_library
hmr