From 79cf1a831ca679ca2643abe857f2f2572a54d42b Mon Sep 17 00:00:00 2001 From: Simon Rose <simon.rose@ess.eu> Date: Tue, 21 Dec 2021 16:07:58 +0100 Subject: [PATCH] Set STREAM_PROTOCOL_PATH for any module if stream has already been loaded. Note that any module that depends on StreamDevice will load it first using `handleDependencies` which is called before we add the _DB paths. So if a module depends on StreamDevice, this will be accurately caught; moreover, if StreamDevice is not loaded, then we don't bother setting this path. --- require-ess/src/require.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/require-ess/src/require.c b/require-ess/src/require.c index 14787804..b91e8840 100644 --- a/require-ess/src/require.c +++ b/require-ess/src/require.c @@ -352,6 +352,8 @@ char *realpathSeparator(const char *location) { return buffer; } +int isModuleLoaded(const char *libname); + static int setupDbPath(const char *module, const char *dbdir) { char *absdir = realpathSeparator(dbdir); /* so we can change directory later safely */ @@ -373,6 +375,9 @@ static int setupDbPath(const char *module, const char *dbdir) { putenvprintf("%s_DB=%s", module, absdir); putenvprintf("TEMPLATES=%s", absdir); + if (isModuleLoaded("stream")) { + pathAdd("STREAM_PROTOCOL_PATH", absdir); + } pathAdd("EPICS_DB_INCLUDE_PATH", absdir); free(absdir); return 0; @@ -727,6 +732,16 @@ const char *getLibLocation(const char *libname) { return NULL; } +int isModuleLoaded(const char *libname) { + moduleitem *m; + + for (m = loadedModules; m; m = m->next) { + if (strcmp(m->content, libname) == 0) + return TRUE; + } + return FALSE; +} + int libversionShow(const char *outfile) { moduleitem *m; size_t lm, lv; -- GitLab