One of the 7z series: Compilation of C ++ modules in the 7zip SDK

Source: Internet
Author: User
ArticleDirectory
    • 7zip
    • SDK
    • C ++ module in 7zip SDK
    • Compile 7zxr. dll

Recently I want to use the 7zip compression, so I will study the 7zip SDK and share the process with you. This is the first article in this series. The main content is compilation.

 

7zip

 

Strictly speaking, there is a problem with the term 7zip, because different official words are used to express appropriate meanings, as shown in:

Because the main purpose of this study is to decompress the 7z file in C ++, for the convenience of the following, it is called 7zip.

 

SDK

 

: Http://www.7-zip.org/sdk.html

Current version: 9.20 (updated)

File Name: lzma918.tar.bz2

Size: 500kb

 

C ++ module in 7zip SDK

7 zip provides support in multiple languages, usually using CSource codeAfter compilation with C ++, the com-based 7z. dll. dll file is not directly compiled, but is renamed from a compiled DLL file in the SDK. The sdkfile description is in lzma.txt. You can read it to learn more.

 

Decompress the downloaded lzma918.tar.bz2 and the structure is as follows:

 

C ++ related files are all in the CPP directory. The location of the compiled files is as follows:

7zipsdk \ CPP \ 7zip \ bundles \

 

Several directory functions are as follows:

Alone7z Compiled with 7z.exe, only 7z, lzma, BCJ, and bcj2 are supported.Algorithm
Format7zextractr After compilation, It is 7zxr. dll, which provides 7z/lzma/BCJ/bcj2Extract
Format7zr After compilation, It is 7zr. dll which provides 7z/lzma/BCJ/bcj2Compression and decompression
Lzmacon After compilation, lzma.exe only supports lzma compression and decompression.

 

Compile 7zxr. dll

The compilation process of modules under several directories is similar. Here we use 7zxr. dll as an example. In the 7zip SDK, the CPP module does not provide the vcproj or SLN file corresponding to vs, but uses the make file. Therefore, nmake must be used in the command line for compilation.

In different versions of Vs, different versions of nmake files are provided. Therefore, you need to call the corresponding vs parameter setting command to set the files before compilation. Take vs2005 installed in the C drive program files as an example:

Run:

 
"C: \ Program Files \ Microsoft Visual Studio 8 \ common7 \ tools \ vsvars32.bat"

Then go to the corresponding 7zipcpp Module Directory and execute the nmake command:

 
Nmake

See:

 

The compiled file is in the O directory and the file name is 7zxr. dll.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.