The UTF-8 char* is marshaled to a UTF-16 string automatically. It must
be allocated on the heap as the CLR will free the returned memory.
This removes entire classes of possible errors, greatly reducing the
code complexity and number of tests.
Using `getcwd()` in main for resolving relative to the current working
directory removed the last public use of `GetAbsolutePath()`, so
`coreclrutil.h` is now stricly `extern "C"`.
- for PowerShell, the `appPath` is the path to the PowerShell libraries
and consoles, i.e., `PWRSH_ROOT`
- the `nativeDllSearchDirs` is just `appPath` plus `CORE_ROOT`
- probably should parse and add `LD_LIBRARY_PATH` to `appPath`
This refactors the last vestiges of command line arguments out of the
command-line host and into libpshost, where all necessary questions are
answered either automatically or through the two introduced environment
variables (`CORE_ROOT` and `PWRSH_ROOT`).
- libpshost resolves the absolute path to the PowerShell binaries from
the environment variable PWRSH_ROOT
- libpshost assumes that PowerShell's AssemblyLoadContext.dll exists in
PWRSH_ROOT and loads during `startCoreCLR()`
- libicu is now only used by libpshost; note that an icu::UnicodeString
is UTF-16, and endianness does not matter (see
http://userguide.icu-project.org/strings#TOC-ICU:-16-bit-Unicode-strings)
This removes the dependency on a TTY and now does what is expected: gets
the (possibly impersonated) username of the current process/thread.
Implementation and tests updated, still uses reentrant versions where possible.
Custom hosting code was refactored to take a path to an assembly instead
of an assembly name coupled with a type and function to
execute. Instead, the host now directly executes the given assembly,
calling its Main function.
The path is resolved relative to the current directory, as should be
expected.