There is a requirement to add a searching path for a specific app.
For this requirement, a new plugin API is added to get the extra searching path.
return "";\r
}\r
\r
+char* plugin_get_extra_dll_path()\r
+{\r
+ _SOUT("### plugin_get_extra_dll_path called");\r
+ return "/tmp";\r
+}\r
+\r
char* plugin_get_native_dll_searching_path()\r
{\r
_SOUT("### plugin_get_native_dll_searching_path called");\r
*/
char* plugin_get_dll_path();
+ /**
+ * @brief return additional pathes to find app assembly.
+ * @return ":" seperated pathes
+ */
+ char* plugin_get_extra_dll_path();
+
/**
* @brief return additional searching pathes to find native libraries.
* @return ":" seperated pathes
*/
const std::string& getAppNIPaths();
+ /**
+ * @brief Set addtional dll searching path for App.
+ * @param[in] paths path
+ */
+ void setExtraDllPaths(const char* paths);
+
/**
* @brief Get the list of directories where the native libraries of this application exist
* @return the list(":" seperated) of paths the loader should probe when looking for native libraries
std::string appNIPaths;
std::string nativeDllSearchingPaths;
std::string appTacPath;
+ std::string extraDllPaths;
int rootFD;
int niRootFD;
};
unsigned int domainId,
coreclr_create_delegate_ptr delegateFunc);
typedef char* (*plugin_get_dll_path_ptr)();
+typedef char* (*plugin_get_extra_dll_path_ptr)();
typedef char* (*plugin_get_native_dll_searching_path_ptr)();
typedef char* (*plugin_get_tpa_ptr)();
typedef void (*plugin_before_execute_ptr)();
plugin_set_app_info_ptr set_app_info;
plugin_set_coreclr_info_ptr set_coreclr_info;
plugin_get_dll_path_ptr get_dll_path;
+ plugin_get_extra_dll_path_ptr get_extra_dll_path;
plugin_get_native_dll_searching_path_ptr get_native_dll_searching_path;
plugin_get_tpa_ptr get_tpa;
plugin_before_execute_ptr before_execute;
void pluginSetAppInfo(const char* appId, const char* managedAssemblyPath);
void pluginSetCoreclrInfo(void* hostHandle, unsigned int domainId, coreclr_create_delegate_ptr delegateFunc);
char* pluginGetDllPath();
+char* pluginGetExtraDllPath();
char* pluginGetNativeDllSearchingPath();
char* pluginGetTPA();
void pluginBeforeExecute();
__pm->addNativeDllSearchingPaths(pluginNativePaths, true);
}
+ char* pluginExtraDllPaths = pluginGetExtraDllPath();
+ if (pluginExtraDllPaths && pluginExtraDllPaths[0] != '\0') {
+ __pm->setExtraDllPaths(pluginExtraDllPaths);
+ }
+
pluginHasLogControl();
std::string libCoreclr(concatPath(__pm->getRuntimePath(), "libcoreclr.so"));
__pm->setAppRootPath(rootPath);
+ char* extraDllPaths = pluginGetExtraDllPath();
+ if (extraDllPaths && extraDllPaths[0] != '\0') {
+ __pm->setExtraDllPaths(extraDllPaths);
+ }
+
opt->flags |= NI_FLAGS_APPNI;
if (isReadOnlyArea(rootPath)) {
appTacPath = concatPath(appBinPath, TAC_SYMLINK_SUB_DIR);
appPaths = appRootPath + ":" + appBinPath + ":" + appLibPath + ":" + appTacPath;
- appNIPaths = appNIBinPath + ":" + appNILibPath + ":"+ appTacPath;
+ appNIPaths = appNIBinPath + ":" + appNILibPath + ":" + appTacPath;
+
+ if (!extraDllPaths.empty()) {
+ appPaths = appPaths + ":" + extraDllPaths;
+ appNIPaths = appNIPaths + ":" + extraDllPaths;
+ }
}
PathManager::PathManager() :
updateAppRelatedPath(appRootPath, appNIRootPath);
}
+// paths: ":" separated muliple path.
+void PathManager::setExtraDllPaths(const char* paths)
+{
+ extraDllPaths = std::string(paths);
+ if (!extraDllPaths.empty()) {
+ appPaths = appPaths + ":" + extraDllPaths;
+ appNIPaths = appNIPaths + ":" + extraDllPaths;
+ }
+}
+
const std::string& PathManager::getRuntimePath()
{
return runtimePath;
__pluginFunc->set_app_info = (plugin_set_app_info_ptr)dlsym(__pluginLib, "plugin_set_app_info");
__pluginFunc->set_coreclr_info = (plugin_set_coreclr_info_ptr)dlsym(__pluginLib, "plugin_set_coreclr_info");
__pluginFunc->get_dll_path = (plugin_get_dll_path_ptr)dlsym(__pluginLib, "plugin_get_dll_path");
+ __pluginFunc->get_extra_dll_path = (plugin_get_extra_dll_path_ptr)dlsym(__pluginLib, "plugin_get_extra_dll_path");
__pluginFunc->get_native_dll_searching_path = (plugin_get_native_dll_searching_path_ptr)dlsym(__pluginLib, "plugin_get_native_dll_searching_path");
__pluginFunc->get_tpa = (plugin_get_tpa_ptr)dlsym(__pluginLib, "plugin_get_tpa");
__pluginFunc->before_execute = (plugin_before_execute_ptr)dlsym(__pluginLib, "plugin_before_execute");
}
}
+char* pluginGetExtraDllPath()
+{
+ if (__pluginFunc && __pluginFunc->get_extra_dll_path) {
+ return __pluginFunc->get_extra_dll_path();
+ } else {
+ return NULL;
+ }
+}
+
char* pluginGetNativeDllSearchingPath()
{
if (__pluginFunc && __pluginFunc->get_native_dll_searching_path) {