GrindCore.net relies on a high-performance native C library (GrindCore) to provide its compression and hashing capabilities. This page explains how these native binaries are organized, distributed via NuGet, and resolved by the .NET runtime across different operating systems and architectures.
GrindCore follows the standard .NET "runtimes" convention for distributing platform-specific native assets. All native binaries are embedded within the project and the resulting NuGet package under the runtimes/{RID}/native/ directory structure src/GrindCore.net.csproj59-103
When a consumer installs the GrindCore NuGet package, the .NET SDK automatically selects the correct binary for the target platform based on the Runtime Identifier (RID) specified in the project configuration src/GrindCore.net.csproj13 At runtime, the .NET P/Invoke layer resolves calls to these libraries by searching the application's execution directory where these assets are deployed via CopyToOutputDirectory src/GrindCore.net.csproj60
The project supports a wide array of platforms including Windows, Linux, and macOS across x64, x86, and ARM architectures.
| Platform | RID | Binary Name | Format |
|---|---|---|---|
| Windows | win-x64, win-x86, win-arm64 | GrindCore.dll | PE (DLL) src/runtimes/win-x64/native/GrindCore.dll1-2 |
| Linux | linux-x64, linux-x86, linux-arm64, linux-arm | libGrindCore.so | ELF (Shared Object) src/runtimes/linux-arm64/native/libGrindCore.so1 |
| macOS | osx-x64, osx-arm64 | libGrindCore.dylib | Mach-O (Dynamic Lib) src/GrindCore.net.csproj79-88 |
The following diagram illustrates how .NET project entities map to the physical native assets stored in the repository.
Native Asset Mapping
Sources: src/GrindCore.net.csproj13 src/GrindCore.net.csproj59-103
The .NET code interacts with these binaries through a P/Invoke interop layer. The project is configured to include local lock file assemblies src/GrindCore.net.csproj9 to ensure native dependencies are correctly tracked during build and deployment.
Interop Resolution Logic
The native library name is consistently referenced as GrindCore (or libGrindCore on Unix), which is then mapped to the specific binary files provided in the runtimes folder src/GrindCore.net.csproj89-103
Sources: src/GrindCore.net.csproj17 src/runtimes/win-x64/native/GrindCore.dll1-2 src/runtimes/linux-arm/native/libGrindCore.so1
While the distribution model is unified, each platform family has unique requirements regarding binary format and loading behavior.
The Windows distribution includes support for legacy x86 (32-bit), standard x64, and modern ARM64 systems src/GrindCore.net.csproj89-103 These are compiled as Portable Executable (PE) files. For detailed information on Windows-specific loading, packaging, and how they are handled during test runs, see Windows Native Binaries (win-x64, win-x86, win-arm64).
Unix-like systems use ELF (Linux) and Mach-O (macOS) formats. The Linux distribution is particularly broad, supporting 32-bit ARM (linux-arm) src/runtimes/linux-arm/native/libGrindCore.so1 often used in IoT scenarios, alongside standard server architectures. macOS support is provided for both Intel-based and Apple Silicon (M1/M2/M3) hardware src/GrindCore.net.csproj79-88 For details on chmod requirements, CI asset copying, and QEMU emulation for ARM testing, see Linux & macOS Native Binaries.
Sources: src/GrindCore.net.csproj59-103 src/runtimes/linux-arm64/native/libGrindCore.so1-2 src/runtimes/linux-arm/native/libGrindCore.so1-2