Skip to main content
7-Zip provides multiple SDKs and APIs for integrating compression functionality into your applications.

Available SDKs

LZMA SDK

Public domain C/C++ compression library

7z Format

Complete 7z format specification

DLL Integration

Use 7-Zip DLLs in your application

Source Code

Full source code on GitHub

LZMA SDK

The LZMA SDK is a public domain compression library:
  • License: Public domain (no restrictions)
  • Languages: C, C++, C#, Java
  • Formats: LZMA, LZMA2, XZ
  • Size: Minimal footprint (~50 KB)
  • Download: 7-zip.org/sdk.html

7z ANSI-C Decoder

Simplified C decoder for 7z archives: Files (from DOC/7zC.txt):
  • 7zDec.c - Low level 7z decoding
  • 7zArcIn.c - Archive opening
  • 7z.h - Main header file
  • 7zTypes.h - Type definitions
Features:
  • Reads 7z archives
  • Extracts files
  • Tests integrity
  • Lists contents
  • LZMA and Copy methods supported

7-Zip DLLs

7-Zip provides COM-based DLLs for Windows:

Available DLLs

Location: CPP/7zip/Bundles/Format7zF/

API Interfaces

IInArchive

For reading archives:

IOutArchive

For creating archives:

Memory Allocation

7-Zip uses custom allocators:

Compression API

LZMA Encoder

LZMA Decoder

Return Codes

From 7zTypes.h (lines 40-60):

Building the SDK

Windows

Linux/macOS

Example Applications

The SDK includes example programs:
  • C/Util/7z/7zMain.c - 7z archive decoder
  • C/Util/Lzma/LzmaUtil.c - LZMA compression utility
  • C/Util/LzmaLib/LzmaLibExports.c - DLL exports

Integration Examples

Compress File in Memory

Extract 7z Archive

Documentation Files

  • DOC/7zC.txt - 7z ANSI-C decoder documentation
  • DOC/7zFormat.txt - 7z format specification
  • DOC/lzma.txt - LZMA algorithm description
  • DOC/Methods.txt - Compression method IDs

License

From DOC/7zC.txt:
7z ANSI-C Decoder is part of the LZMA SDK. LZMA SDK is written and placed in the public domain by Igor Pavlov.
The LZMA SDK is public domain - you can use it freely in any project without restrictions or attribution requirements.

See Also