InstalledRuntime class
Finds and loads the QAROS runtime, qar-streaming-c.dll, the same way as the C
header's qar_library_load(NULL) and every other QAROS binding (ADR-0339). The first
match wins:
- (step 0) a
qar-streaming-c.dllalready loaded in the process: nothing is loaded; - beside this binding: the folder of the
Quaternar.Qarosassembly, then the application's base directory (a test project's output folder, a development ZIP); - the folder named by the
QAROS_RUNTIME_DIRenvironment variable; when it is set, a runtime missing there is an error; - the installed QAROS:
<InstallFolder>\bin, read fromHKLMSOFTWARE\Quaternar\QAROS, valueInstallFolder; an installed copy that fails to load is an error; - every folder on
PATH, in order. The current directory is never searched.
Each loads from its absolute path, its dependencies from its own folder and System32 only.
Library.Init loads it on first use, so calling InstalledRuntime.Load yourself
is only needed to learn about a missing runtime early. Windows only; elsewhere the
binding's DllImport probing finds the library.
Namespace: Quaternar.Qaros · Assembly: Quaternar.Qaros.dll
public static class InstalledRuntime
Fields
LibraryFileName
File name of the C runtime library inside the installed bin folder.
public const string LibraryFileName = "qar-streaming-c.dll"
Value: string
RuntimeDirEnvironmentVariable
Environment variable naming a folder that holds the runtime (step 2).
public const string RuntimeDirEnvironmentVariable = "QAROS_RUNTIME_DIR"
Value: string
Properties
LoadedLibraryPath
Full path of the loaded qar-streaming-c.dll, or null before a successful
InstalledRuntime.Load.
public static string? LoadedLibraryPath { get; }
Value: string
Methods
| Member | Description |
|---|---|
| TryGetBinFolder() | <InstallFolder>\bin of the installed QAROS, read from HKLM (never HKCU, which every process of the user can write). Null when QAROS is not installed or the platform is not Windows. |
| Load() | Loads the runtime by the lookup described on InstalledRuntime: already loaded, else beside the binding, else QAROS_RUNTIME_DIR, else the installed QAROS, else on PATH. Returns the loaded file's path. Fails with StatusCode.LogicError when nothing is found, or when the copy that QAROS_RUNTIME_DIR or the installation names is missing or does not load. |
| Load(string) | Loads qar-streaming-c.dll from libraryPath instead of the installation. For our own development builds; a distributed application uses InstalledRuntime.Load. Must run before the first QAR call. |
| TryGetRuntimeDirFromEnvironment() | The folder QAROS_RUNTIME_DIR names, or null when it is unset or empty. |
TryGetBinFolder
<InstallFolder>\bin of the installed QAROS, read from HKLM (never
HKCU, which every process of the user can write). Null when QAROS is not installed
or the platform is not Windows.
public static string? TryGetBinFolder()
Returns: string
Load()
Loads the runtime by the lookup described on InstalledRuntime: already
loaded, else beside the binding, else QAROS_RUNTIME_DIR, else the installed QAROS,
else on PATH. Returns the loaded file's path. Fails with
StatusCode.LogicError when nothing is found, or when the copy that
QAROS_RUNTIME_DIR or the installation names is missing or does not load.
public static Result<string> Load()
Load(string)
Loads qar-streaming-c.dll from libraryPath instead of the
installation. For our own development builds; a distributed application uses
InstalledRuntime.Load. Must run before the first QAR call.
public static Result<string> Load(string libraryPath)
Parameters
| Name | Type | Description |
|---|---|---|
libraryPath | string |
TryGetRuntimeDirFromEnvironment
The folder QAROS_RUNTIME_DIR names, or null when it is unset or empty.
public static string? TryGetRuntimeDirFromEnvironment()
Returns: string