namespace runtime {
namespace dotnetcore {
+#if defined (__aarch64__)
+#define ARCHITECTURE_IDENTIFIER "arm64"
+#elif defined (__arm__)
+#define ARCHITECTURE_IDENTIFIER "arm"
+#elif defined (__x86_64__)
+#define ARCHITECTURE_IDENTIFIER "x64"
+#elif defined (__i386__)
+#define ARCHITECTURE_IDENTIFIER "x86"
+#else
+#define ARCHITECTURE_IDENTIFIER "unknown"
+#endif
+
+static std::string getExtraNativeLibDirs(const std::string& appRoot)
+{
+ // auto generated directory by nuget will be considered later
+ std::string candidate = concatPath(appRoot, "lib/" ARCHITECTURE_IDENTIFIER);
+ if (!strncmp(ARCHITECTURE_IDENTIFIER, "arm64", 5)) {
+ candidate = candidate + ":" + concatPath(appRoot, "lib/aarch64");
+ }
+
+ return candidate;
+}
+
CoreRuntime::CoreRuntime() :
initializeClr(nullptr),
executeAssembly(nullptr),
assembliesInDirectory(searchDirectories, tpa);
std::string nativeLibPath;
- nativeLibPath = appLib + ":" + appBin + ":" + __nativeLibDirectory;
+ nativeLibPath = getExtraNativeLibDirs(appRoot) + ":" + appLib + ":" + appBin + ":" + __nativeLibDirectory;
std::string appName = std::string("dotnet-launcher-") + std::to_string(getpid());
if (!initializeCoreClr(appName.c_str(), probePath.c_str(), nativeLibPath.c_str(), tpa.c_str())) {