Musa.Runtime - Universal C++ RunTime Library
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.
- 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
See Musa.Runtime.TestForDriver for more information...
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();
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());
}
}
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">
<!-- Optional: Expected version -->
<Version>0.5.1</Version>
</PackageReference>
</ItemGroup>- Download the latest package from Releases and unzip it.
- Edit your
.vcxprojfile 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" />
<!-- above this row -->
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />Add the following code to your .vcxproj file:
<PropertyGroup>
<MusaRuntimeOnlyHeader>true</MusaRuntimeOnlyHeader>
</PropertyGroup>This mode will not automatically import lib files.
IDE:Visual Studio 2022 latest version
> git clone --recurse-submodules https://github.com/MiroKaku/Musa.Runtime.git
> .\BuildAllTargets.cmdThanks to JetBrains for providing free licenses such as Resharper C++ for my open-source projects.
Great thanks to these excellent projects. Without their existence, there would be no Musa.Runtime then.