1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | #include <string> |
6 | |
7 | // Get the path to entrypoint executable |
8 | bool GetEntrypointExecutableAbsolutePath(std::string& entrypointExecutable); |
9 | |
10 | // Get absolute path from the specified path. |
11 | // Return true in case of a success, false otherwise. |
12 | bool GetAbsolutePath(const char* path, std::string& absolutePath); |
13 | |
14 | // Get directory of the specified path. |
15 | // Return true in case of a success, false otherwise. |
16 | bool GetDirectory(const char* absolutePath, std::string& directory); |
17 | |
18 | // |
19 | // Get the absolute path to use to locate libcoreclr.so and the CLR assemblies are stored. If clrFilesPath is provided, |
20 | // this function will return the absolute path to it. Otherwise, the directory of the current executable is used. |
21 | // |
22 | // Return true in case of a success, false otherwise. |
23 | // |
24 | bool GetClrFilesAbsolutePath(const char* currentExePath, const char* clrFilesPath, std::string& clrFilesAbsolutePath); |
25 | |
26 | // Add all *.dll, *.ni.dll, *.exe, and *.ni.exe files from the specified directory to the tpaList string. |
27 | void AddFilesFromDirectoryToTpaList(const char* directory, std::string& tpaList); |
28 | |
29 | // |
30 | // Execute the specified managed assembly. |
31 | // |
32 | // Parameters: |
33 | // currentExePath - Path to the current executable |
34 | // clrFilesAbsolutePath - Absolute path to the folder where the libcoreclr.so and CLR managed assemblies are stored |
35 | // managedAssemblyPath - Path to the managed assembly to execute |
36 | // managedAssemblyArgc - Number of arguments passed to the executed assembly |
37 | // managedAssemblyArgv - Array of arguments passed to the executed assembly |
38 | // |
39 | // Returns: |
40 | // ExitCode of the assembly |
41 | // |
42 | int ExecuteManagedAssembly( |
43 | const char* currentExeAbsolutePath, |
44 | const char* clrFilesAbsolutePath, |
45 | const char* managedAssemblyAbsolutePath, |
46 | int managedAssemblyArgc, |
47 | const char** managedAssemblyArgv); |
48 | |
49 | |
50 | #if defined(__APPLE__) |
51 | #include <mach-o/dyld.h> |
52 | static const char * const coreClrDll = "libcoreclr.dylib" ; |
53 | #else |
54 | static const char * const coreClrDll = "libcoreclr.so" ; |
55 | #endif |
56 | |
57 | |