Installation
On This Page
Binary for WindowsBinary for Linux/Unix
Source Code
In order to develop C++ application with garbage collection of HnxGC, you need to include some C++ header files in your C++ source code and link with HnxGC static library or dynamic-loaded library. You can download the source code of HnxGC and build the library for your specific platform, or you can just download our pre-compiled binary package for some popular platforms.
Here is some installation descriptions of pre-compiler binary package and source code package.
Binary For Windows
(1) Download and unpack the zip file that matches requirement;
e.g. download the hnxgc_win32_x86_mt_dll.zip and unpack it into C:\HnxGC;
(2) in the unpacked HnxGC directory, you will find following subdirectories:
| <bin> | may be empty for some static library packages of HnxGC, in other cases it will contain files required by application at runtime, such as "HnxGC.dll"; |
| <include> | contains C++ header files that could be included by your C++ application codes; |
| <lib> | contains pre-compiled binary libraries for the linkage stage of building your application; |
| <misc> | directory "misc" contains some codes that can be used to test the installation of HnxGC. |
You can copy or move some of these files to appropriate directories in your system,
e.g. copy the "HnxGC.dll" to C:\Windows\System32, etc.
(3) Modify your project settings.
- add "C:\HnxGC\include" to the include path of your project.
e.g. add it at "Project Properties | C/C++ | General | Additional Include Directories ";
- add "C:\HnxGC\lib" to the libraries path of your project.
e.g. add it at "Project Properties | Linker | General | Additional Library Directories ";
- add preprocessor definition HNXGC_CONFIG_NODLL for static linkage of HnxGC library. (skip this step if using a DLL version)
e.g. add at "Project Properties | C/C++ | Preprocessor | Preprocessor Definitions" as "...;HNXGC_CONFIG_NODLL;..."
or, you can define the macro in your C++ source before include the "HnxGC.h" header file,
e.g.
#define HNXGC_CONFIG_NODLL
#include <hnxGC/hnxGC.h>
(4) Build your project and run with the "HnxGC.dll".
e.g. put the "C:\HnxGC" in your PATH environment, or distribute the "HnxGC.dll" with your application.
The HnxGC binary packages may come with a simple batch file "BuildTest.bat" in the <misc> directory. You can run the batch to build the TestFeatures program.
Also, a visual studio 2005 solution and project files are included, you can just double-click the "HnxGC\misc\misc.sln" to open the solution and build the TestFeatures program.
Binary For Linux
(1) Download and unpack the tar.gz file that matches requirement;
e.g. download the hnxgc_linux_x86_mt_dll.tar.gz and unpack it into /HnxGC;
(2) in the unpacked HnxGC directory, you will find following subdirectories:
| <include> | contains C++ header files that could be included by your C++ application codes; |
| <lib> | contains pre-compiled binary libraries, such as .a static library or .so shared object library; |
| <misc> | directory "misc" contains some codes that can be used to test the installation of HnxGC. |
You can copy or move some of these files to appropriate directories in your system,
e.g. copy the "libhnxgc.so" to /lib, etc.
(3) Modify your project settings.
- add "/HnxGC/include" to the include path of your project.
e.g. g++ -c -I /HnxGC/include ;
- add "/HnxGC/lib" to the libraries path of your project.
e.g. g++ -L/HnxGC/lib -lhnxgc;
(4) Build your project and run.
e.g. g++ -O2 -I/HnxGC/include <your c++ source> -L/HnxGC/lib -lhnxgc -lpthread
The HnxGC binary packages may come with a simple batch file "BuildTest.sh" in the <misc> directory. You can run the batch to build the TestFeatures program.
Source Code
Although we provide two types of packages (.zip and .tar.gz) for the source code, they are almost the same. The difference is that the .zip source files are formated with CR-LF(Carriage Return plus Line Feed) pairs, while .tar.gz source files are LF(Line Feed) formated.
It is very easy to compile the source code and rebuild the HnxGC library for an experienced C++ developer, as we assume you are since you choose download the source code of HnxGC instead pre-compiled binary.
The <src> subdirectory contains all source files that build the HnxGC library, and some for testing applications. You can build the single-thread HnxGC library by C++ files in the <hnxGC_ST> subdirectory, and multi-threading HnxGC including Uni-processor and Multi-Processors version by files in the <hnxGC_MT> subdirectory. The <hnx> subdirectory contains some subroutines that are required by HnxGC library or application. The <include> subdirectory contains C++ header files for HnxGC application. The <misc> subdirectory contains testing application source code.
The <build> subdirectory contains some sample batch files that build the HnxGC library. For example, the "b_vc80win32x86.bat" batch can be used to build all HnxGC libraries for win32 x86 platform under visual c++ 2005. Similarly, "b_vc80win64ia64.bat" is for VC2005 and Itanium platform. "b_vc71win32x86.bat" is for visual C++ 2003, etc. To build HnxGC for Linux/Unix variations, you can try or/and modify the "b_gccLinux.sh" for your specific platform.