Musa.Runtime 0.3.2

Requires NuGet 2.5 or higher.

dotnet add package Musa.Runtime --version 0.3.2                
NuGet\Install-Package Musa.Runtime -Version 0.3.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Musa.Runtime" Version="0.3.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Musa.Runtime --version 0.3.2                
#r "nuget: Musa.Runtime, 0.3.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Musa.Runtime as a Cake Addin
#addin nuget:?package=Musa.Runtime&version=0.3.2

// Install Musa.Runtime as a Cake Tool
#tool nuget:?package=Musa.Runtime&version=0.3.2                

Musa.Runtime - Universal C++ RunTime Library

Actions Status nuget LICENSE Visual Studio Windows Platform

1. About

Musa.Runtime is a Microsoft MSVC runtime library based on Musa.Core and is an implementation of the new architecture of ucxxrt.

It allows kernel developers to have a C++ development experience similar to that of application developers.

1.1 Features

  • support x64、ARM64 (Experimental)
  • support New/Delete
  • support C++ Exception (/EHa、/EHsc) (IRQL ⇐ APC_LEVEL)
  • support Static Objects
  • support SAFESEH、GS (Buffer Security Check)
  • support STL (OneCore、CoreCRT)
  • support thread_local

1.2 Example

<details>

<summary>See Musa.Runtime.TestForDriver for more information...</summary>

<pre><code> void Test$ThrowUnknow() { try { try { try { throw std::wstring(); } catch (int& e) { ASSERT(false); MusaLOG("Catch Exception: %d\n", e); } } catch (std::string& e) { ASSERT(false); MusaLOG("Catch Exception: %s\n", e.c_str()); } } catch (...) { MusaLOG("Catch Exception: ...\n"); } }

void Test$HashMap() { auto Rand = std::mt19937_64(::rand()); auto Map = std::unordered_map<uint32_t, std::string>(); for (auto i = 0u; i < 10; ++i) { Map[i] = std::to_string(Rand()); }

for (const auto& Item : Map) {
    MusaLOG("map[%ld] = %s\n", Item.first, Item.second.c_str());
}

} </code></pre>

</details>

2. How to use

First, rename DriverEntry to DriverMain.

Right click on the project, select "Manage NuGet Packages". Search for Musa.Runtime, choose the version that suits you, and then click "Install".

Or

If your project template uses Mile.Project.Windows, you can add the following code directly to your .vcxproj file:

  <ItemGroup>
    <PackageReference Include="Musa.Runtime">
      
      <Version>0.1.0</Version>
    </PackageReference>
  </ItemGroup>

2.2 Method 2

  1. Download the latest package from Releases and unzip it.
  2. Edit your .vcxproj file and add the following code:
  <PropertyGroup>
    <MusaRuntimeOnlyHeader>false</MusaRuntimeOnlyHeader>
  </PropertyGroup>
  <Import Project="..\Musa.Runtime\config\Musa.Runtime.Config.props" />
  <Import Project="..\Musa.Runtime\config\Musa.Runtime.Config.targets" />
  
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

2.3 Header-only mode

Add the following code to your .vcxproj file:

  <PropertyGroup>
    <MusaRuntimeOnlyHeader>true</MusaRuntimeOnlyHeader>
  </PropertyGroup>

This mode will not automatically import lib files.

3. How to build

IDE:Visual Studio 2022 latest version

> git clone --recurse-submodules https://github.com/MiroKaku/Musa.Runtime.git
> .\BuildAllTargets.cmd

4. Acknowledgements

Thanks to JetBrains for providing free licenses such as Resharper C++ for my open-source projects.

<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/ReSharperCPP_icon.png" alt="ReSharper C++ logo." width=200>

5. References

Great thanks to these excellent projects. Without their existence, there would be no Musa.Runtime then.

Product Compatible and additional computed target framework versions.
native native is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.2 50 7/25/2024

Fix: CRT initialization function is optimized away
Update: Musa.Core to 0.3.2
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQRY41VgHnSyeUsFmP7qVn/Erg8VwgUCZqJl0AAKCRDqVn/Erg8V
wl/ZAQCBtdTPisXDESg/ri6KsIzxC7ux3PZ2BTJ3OjHUlyVHWgD/VLYIhkzdDuGu
bwvsgJMQ2h2eFFoeC7bP3PK4WgmWOw0=
=0bTB
-----END PGP SIGNATURE-----