2021-09-20 16:01:17 +01:00
|
|
|
From 439e2effe1cc372925daf6d5c28569663ffb93ed Mon Sep 17 00:00:00 2001
|
2021-01-25 19:19:01 +00:00
|
|
|
From: Tadeo Kondrak <me@tadeo.ca>
|
|
|
|
Date: Mon, 25 Jan 2021 11:17:44 -0700
|
|
|
|
Subject: [PATCH] Call weak function to allow adding preloaded plugins after
|
|
|
|
compile
|
|
|
|
|
|
|
|
---
|
|
|
|
src/core/vscore.cpp | 19 +++++++++++++++++++
|
|
|
|
src/core/vscore.h | 5 +++++
|
|
|
|
2 files changed, 24 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/src/core/vscore.cpp b/src/core/vscore.cpp
|
2021-09-20 16:01:17 +01:00
|
|
|
index f8e69062..4ce4c623 100644
|
2021-01-25 19:19:01 +00:00
|
|
|
--- a/src/core/vscore.cpp
|
|
|
|
+++ b/src/core/vscore.cpp
|
2021-09-20 16:01:17 +01:00
|
|
|
@@ -1791,6 +1791,20 @@ void VSCore::destroyFilterInstance(VSNode *node) {
|
2021-01-25 19:19:01 +00:00
|
|
|
freeDepth--;
|
|
|
|
}
|
|
|
|
|
|
|
|
+extern "C" {
|
|
|
|
+void __attribute__((weak)) VSLoadPluginsNix(void (*load)(void *data, const char *path), void *data);
|
|
|
|
+
|
|
|
|
+struct VSLoadPluginsNixCallbackData {
|
|
|
|
+ VSCore *core;
|
|
|
|
+ const char *filter;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static void VSLoadPluginsNixCallback(void *data, const char *path) {
|
|
|
|
+ auto callbackData = static_cast<VSLoadPluginsNixCallbackData *>(data);
|
|
|
|
+ callbackData->core->loadAllPluginsInPath(path, callbackData->filter);
|
|
|
|
+}
|
|
|
|
+}
|
|
|
|
+
|
2021-09-20 16:01:17 +01:00
|
|
|
VSCore::VSCore(int flags) :
|
2021-01-25 19:19:01 +00:00
|
|
|
numFilterInstances(1),
|
2021-09-20 16:01:17 +01:00
|
|
|
numFunctionInstances(0),
|
|
|
|
@@ -1918,6 +1932,11 @@ VSCore::VSCore(int flags) :
|
2021-01-25 19:19:01 +00:00
|
|
|
} // If neither exists, an empty string will do.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+ if (VSLoadPluginsNix != nullptr) {
|
|
|
|
+ VSLoadPluginsNixCallbackData data{this, filter.c_str()};
|
|
|
|
+ VSLoadPluginsNix(VSLoadPluginsNixCallback, &data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
VSMap *settings = readSettings(configFile);
|
2021-09-20 16:01:17 +01:00
|
|
|
const char *error = vs_internal_vsapi.mapGetError(settings);
|
2021-01-25 19:19:01 +00:00
|
|
|
if (error) {
|
|
|
|
diff --git a/src/core/vscore.h b/src/core/vscore.h
|
2021-09-20 16:01:17 +01:00
|
|
|
index 2ce0f56b..2982b133 100644
|
2021-01-25 19:19:01 +00:00
|
|
|
--- a/src/core/vscore.h
|
|
|
|
+++ b/src/core/vscore.h
|
2021-09-20 16:01:17 +01:00
|
|
|
@@ -985,6 +985,9 @@ public:
|
|
|
|
std::string getV3ArgString() const;
|
2021-01-25 19:19:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
+extern "C" {
|
|
|
|
+static void VSLoadPluginsNixCallback(void *data, const char *path);
|
|
|
|
+}
|
|
|
|
|
|
|
|
struct VSPlugin {
|
2021-09-20 16:01:17 +01:00
|
|
|
friend struct VSPluginFunction;
|
|
|
|
@@ -1140,6 +1143,8 @@ public:
|
2021-01-25 19:19:01 +00:00
|
|
|
|
2021-09-20 16:01:17 +01:00
|
|
|
explicit VSCore(int flags);
|
2021-01-25 19:19:01 +00:00
|
|
|
void freeCore();
|
|
|
|
+
|
|
|
|
+ friend void VSLoadPluginsNixCallback(void *data, const char *path);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VSCORE_H
|
|
|
|
--
|
2021-09-20 16:01:17 +01:00
|
|
|
2.32.0
|
2021-01-25 19:19:01 +00:00
|
|
|
|