Eternal.LZMA2Simple.Native 1.0.6

Requires NuGet 5.10 or higher.

dotnet add package Eternal.LZMA2Simple.Native --version 1.0.6
                    
NuGet\Install-Package Eternal.LZMA2Simple.Native -Version 1.0.6
                    
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="Eternal.LZMA2Simple.Native" Version="1.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Eternal.LZMA2Simple.Native" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="Eternal.LZMA2Simple.Native" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Eternal.LZMA2Simple.Native --version 1.0.6
                    
#r "nuget: Eternal.LZMA2Simple.Native, 1.0.6"
                    
#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.
#:package Eternal.LZMA2Simple.Native@1.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Eternal.LZMA2Simple.Native&version=1.0.6
                    
Install as a Cake Addin
#tool nuget:?package=Eternal.LZMA2Simple.Native&version=1.0.6
                    
Install as a Cake Tool

Eternal.LZMA2Simple.Native

A simplified C++ library to compress and decompress using the 7-Zip library, based on version 25.01 of 7-Zip. This package contains the native Windows x64 static library.

Copyright Eternal Developments, LLC. All Rights Reserved. Licensed under MIT.

For the pure C# port of the same API, see the Eternal.LZMA2SimpleCS package. The two are independent implementations; this package does not contain managed code and the C# package does not P/Invoke into this one.

Requirements

Platform x64 only. No x86, ARM or ARM64 binary is shipped.
CPU AVX2 required. Built with /arch:AVX2.
Consumption packages.config only.
C++ standard C++17 or later.

AVX2 is a hard runtime requirement

The library is compiled with /arch:AVX2, so it requires an Intel Haswell (2013) or AMD Excavator (2015) processor or newer. On an older CPU it will fault with an illegal instruction, not fail gracefully. If you ship to end users, gate on IsProcessorFeaturePresent( PF_AVX2_INSTRUCTIONS_AVAILABLE ) or document the floor.

PackageReference does not work

NuGet does not run build\native\*.props / *.targets auto-import for C++ projects that use PackageReference. This package must be installed into a packages.config project; otherwise the headers will not be found and the library will not be linked.

Build settings

The library is built with the v145 toolset (Visual Studio 18), but it is not locked to v145 at link time: the MSVC STL stamps detect_mismatch("_MSC_VER", "1900"), which is the ABI-stability marker shared by every v14x toolset. Any VS 2015–2026 toolset links it, provided the CRT matches.

Setting Debug Release
Runtime library /MDd /MD
_ITERATOR_DEBUG_LEVEL 2 0
Optimisation /Od /O2 /Ob2 /Oi /Ot /Oy
Debug information none none
RTTI /GR (on) /GR (on)
Exceptions off off
Control Flow Guard /guard:cf /guard:cf
Struct alignment /Zp8 /Zp8
Instruction set /arch:AVX2 /arch:AVX2
Whole program optimisation off off

/GL is deliberately not used, so the archive holds real COFF objects. Consumers do not need /LTCG and are not tied to one exact compiler build.

No debug information

The packaged archives are built with debug information disabled. There is no PDB to deploy, no LNK4099 when the library is consumed from the package folder, and none of the build machine's absolute source paths are embedded in the archive.

The consequence is that you cannot step into this library in a debugger, and call stacks passing through it show only symbol names. If you need to debug into the library, build it from source: the project emits /Z7 by default and only the package build turns it off.

Matching the CRT

The archive carries /FAILIFMISMATCH records for RuntimeLibrary and _ITERATOR_DEBUG_LEVEL. Linking the wrong flavour produces hard LNK2038 errors ending in LNK1319, not a warning:

  • A /MDd consumer must link the Debug library.
  • A /MD consumer must link the Release library.

The package picks the flavour from $(Configuration): a configuration whose name contains Debug gets the Debug library, anything else gets Release. If your project uses other configuration names, set the flavour explicitly:

<PropertyGroup>
  <Lzma2SimpleNativeFlavor>Debug</Lzma2SimpleNativeFlavor>
</PropertyGroup>

Usage

#include "Lzma2Lib.h"

// A source buffer with the uncompressed data, and a destination buffer large enough
// for the worst possible compression.
CLzmaData data;

// Encoder properties - defaults are set in the constructor.
CLzma2EncoderProperties encoder_properties;

// The result of the compression.
CLzma2Result compress_result;

// The memory interface can override all memory operations; the progress interface
// can report progress. Both may be null.
Lzma2Compress( &data, &encoder_properties, &compress_result, &memory_interface, &progress_interface );

compress_result.PropertySummary is a single byte that must be passed to the decompressor. The LZMA1 entry points in Lzma1Lib.h work the same way, except that CLzma1Result carries five property bytes instead of one.

Full Doxygen documentation: https://eternaldevelopments.com/docs

Properties this package defines

Property Meaning
Lzma2SimpleNativeFlavor Debug or Release. Set it to override the automatic choice.
Lzma2SimpleNativeIncludeDir Directory holding the public headers.
Lzma2SimpleNativeLibFile Full path of the archive that will be linked.
Lzma2SimpleNativeVersion Package version, for diagnostics.

Building this package from source

.\NuGet\Pack.ps1

The script builds both configurations with -p:Lzma2SimpleDebugInformationFormat=None into Binaries\Package\ and packs from there, leaving the ordinary Binaries\x64\ development builds and their /Z7 debug information untouched.

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.
  • native 0.0

    • No dependencies.

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
1.0.6 65 11/18/2026

Adds Linux x64 static libraries, built with clang through the WSL2 toolset at -march=x86-64-v2; they contain native ELF objects rather than LLVM bitcode, so no LTO is required downstream.  
   Public headers now define LZMA2SIMPLE_VERSION and carry a /FAILIFMISMATCH record, so linking a mismatched library fails at link time. Public headers are now self-contained. x64 only; Win32 configurations removed. RTTI and Control Flow Guard enabled.