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. 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); - when the
QAR_INSTANCEenvironment variable names a QAROS instance, that instance's runtime folder (InstalledRuntime.TryGetInstanceRuntimeFolder):defaultis the installed QAROS, any other name the folder recorded asRuntimeFolderunderHKCU\SOFTWARE\Quaternar\QAROS\Instances\<name>, which a QAROS development hub writes for the apps it starts (else a registered instance's<InstallFolder>\bin). When the variable is set, an invalid or unknown instance or a runtime missing there is an error, never a reason to load another instance's runtime; - 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
| Member | Description |
|---|---|
| LibraryFileName | File name of the C runtime library inside the installed bin folder. |
| InstanceEnvironmentVariable | Environment variable naming the QAROS instance the application belongs to (step 2): the runtime is loaded from that instance's folder, and enrols with its hub. |
| DefaultInstanceName | Name of the installed (HKLM) instance. |
LibraryFileName
File name of the C runtime library inside the installed bin folder.
public const string LibraryFileName = "qar-streaming-c.dll"
Value: string
InstanceEnvironmentVariable
Environment variable naming the QAROS instance the application belongs to (step 2): the runtime is loaded from that instance's folder, and enrols with its hub.
public const string InstanceEnvironmentVariable = "QAR_INSTANCE"
Value: string
DefaultInstanceName
Name of the installed (HKLM) instance.
public const string DefaultInstanceName = "default"
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 the instance QAR_INSTANCE names, else the installed QAROS, else on PATH. Returns the loaded file's path. Fails with StatusCode.LogicError when nothing is found, when QAR_INSTANCE names an invalid or unknown instance, or when the copy that instance 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. |
| TryGetRequestedInstance() | The instance QAR_INSTANCE names, exactly as set, or null when it is unset or empty. |
| IsValidInstanceName(string?) | Whether name is a QAROS instance name: 1-64 of A-Z a-z 0-9 . _ -. |
| TryGetInstanceRuntimeFolder(string) | The folder holding the runtime of instance instance: for default the installed QAROS's bin (InstalledRuntime.TryGetBinFolder), for any other name the value RuntimeFolder of HKCU\SOFTWARE\Quaternar\QAROS\Instances\<name>, else that record's <InstallFolder>\bin (a registered named instance). Null when the name is not valid, no fully qualified folder is recorded, or the platform is not Windows. HKCU is writable by every process of the user, like the environment QAR_INSTANCE comes from: the record carries the same trust as an environment variable naming a folder, and is read only when QAR_INSTANCE names that instance. |
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 the instance QAR_INSTANCE names, else the
installed QAROS, else on PATH. Returns the loaded file's path. Fails with
StatusCode.LogicError when nothing is found, when QAR_INSTANCE
names an invalid or unknown instance, or when the copy that instance 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 |
TryGetRequestedInstance
The instance QAR_INSTANCE names, exactly as set, or null when it is unset or
empty.
public static string? TryGetRequestedInstance()
Returns: string
IsValidInstanceName
Whether name is a QAROS instance name: 1-64 of A-Z a-z 0-9 . _ -.
public static bool IsValidInstanceName(string? name)
Parameters
| Name | Type | Description |
|---|---|---|
name | string |
Returns: bool
TryGetInstanceRuntimeFolder
The folder holding the runtime of instance instance: for
default the installed QAROS's bin (InstalledRuntime.TryGetBinFolder), for any
other name the value RuntimeFolder of
HKCU\SOFTWARE\Quaternar\QAROS\Instances\<name>, else that record's
<InstallFolder>\bin (a registered named instance). Null when the name is not
valid, no fully qualified folder is recorded, or the platform is not Windows. HKCU is writable by every
process of the user, like the environment QAR_INSTANCE comes from: the record
carries the same trust as an environment variable naming a folder, and is read only
when QAR_INSTANCE names that instance.
public static string? TryGetInstanceRuntimeFolder(string instance)
Parameters
| Name | Type | Description |
|---|---|---|
instance | string |
Returns: string