You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it looks like the only way to write plugins is to write them in c++.
Allowing plugins to be written in C opens up a lot of possibilities - not just C, but any language that can create C-ABI compatible stuff can be used for writing the plugin, and that list is huge compared to just C++. As I understand it, C++ has no well defined ABI which makes it hard to interface with it from any other language.
And since oomd calls the plugins rather than the other way around, it is not possible to simply "wrap" oomd either.
I understand that there might be limitations (I'm mostly thinking macros, and converting types) that make this non-trivial. However, is it possible? If yes, what needs to be done?
The text was updated successfully, but these errors were encountered:
This sounds like a useful idea and I think it should be possible. Similar to how there's a BaseKillPlugin, I could see a BaseCPlugin providing a C interface to oomd's plugin API.
In theory the only C++ interfaces you'd need a C API for are the ones inside BasePlugin.h. There's a bunch of helper functions scattered around util/ but it's not strictly necessary to use them in plugins.
Then you could have a plugins structured like:
$ ls
MyCPlugin.c
BaseCPlugin.cpp
$ head BaseCPlugin.cpp
#include "MyCPlugin.c"
REGISTER_PLUGIN(my_c_plugin, ...)
...
$ head MyCPlugin.c
// magic function BaseCPlugin.cpp will try to use
int init(CMonitoredResources *res, CPluginArgs *args) {
...
}
// magic function BaseCPlugin.cpp will try to use
CPluginRet run(COomdContext *ctx) {
...
}
Currently it looks like the only way to write plugins is to write them in c++.
Allowing plugins to be written in C opens up a lot of possibilities - not just C, but any language that can create C-ABI compatible stuff can be used for writing the plugin, and that list is huge compared to just C++. As I understand it, C++ has no well defined ABI which makes it hard to interface with it from any other language.
And since oomd calls the plugins rather than the other way around, it is not possible to simply "wrap" oomd either.
I understand that there might be limitations (I'm mostly thinking macros, and converting types) that make this non-trivial. However, is it possible? If yes, what needs to be done?
The text was updated successfully, but these errors were encountered: