[GetReuse Home] [SDK Start Page] [Usage] [Reference] [Bindings] [ChangeLog] [Download SDK]

Note: GetReuse SDK texts have not been proofread yet. Please be patient.

This document describes a sample program from the GetReuse SDK and provides information how to compile and link your programs with the GetReuse SDK.

A Typical Usage of the GetReuse SDK

Somewhere in an include-section of your program, include a declaration of the GetReuse SDK functions:

#include <getreuse.h>

Having buffers of bytes buf1 and buf2, calculate a similarity between content of the buffers as follows.

These steps are demonstrated in details by a sample program.

A Sample GetReuse SDK Program

The folder examples/c from the GetReuse SDK distribution contains the sample code distcalc.c.

The command-line program distcalc gets a list of files as arguments. For each pair of files f1 and f2, the program prints a line of information into the standard output. The information line consists of five information units divided by the TAB character:

The GetReuse SDK contains a test data that is located in the folder tests/data. The program distcalc should correctly work with these files and produce result that is the same as the content of the file tests/etalon_output.

Compiler Settings

In order to compile a program with the GetReuse SDK elements, you should specify to a compiler:

These settings are compiler-dependent. Settings for the gcc compiler and the Microsoft Visual C compiler are described below.

gcc Compiler Settings

Parameter -Idir is used to add directory dir to the list of directories to be searched for header files. Substitute dir by a path to the folder with the GetReuse SDK header file getreuse.h.

In order to link with the GetReuse SDK code library, just add a path to the library (including file name) into parameters of a compiler or a linker.

Alternate way to link with GetReuse SDK code library is to specify parameters -lgetreuse -Ldir where dir is a directory with the GetReuse SDK library file libgetreuse.a.

Directory examples/c contains the sample Makefile that demonstrates a compilation of the sample program.

$ make
cc -I../../include -Wall   -c -o distcalc.o distcalc.c
cc -o distcalc distcalc.o ../../libs/linux586/libgetreuse.a

Microsoft Visual C Compiler Settings

In order to specify folder to be searched for the GetReuse SDK header file getreuse.h, go to menu Project, submenu Settings. In the Project Settings window, select All Configurations as Settings for, switch to the tab C/C++, find Proprocessor in Category and add folder name into the Additional include deirectories field.

Getting the Project Settings window

Figure 1. Getting the Project Settings window

Setting include path

Figure 2. Setting include path

In order to link with the GetReuse SDK code library, add a path to the library (including file name) into the linker parameters. In the Project Settings window, switch to the tab Link, find General in Category and add the path into the field Object/library modules.

Adding GetReuse SDK library

Figure 3. Adding GetReuse SDK library

There are four libraries for different configurations of the Microsoft Visual C compiler:

  • getreuse.lib for the “Single-Threaded Release” configuration

  • getreused.lib for the “Single-Threaded Debug” configuration

  • getreusemt.lib for the “Multithreaded Release” configuration

  • getreusemtd.lib for the “Multithreaded Debug” configuration

The folder examples/c/msvc contains the sample workspace and project files for Microsoft Visual C.

© 2003, 2004 DataHansa software. All rights reserved.
All registered names are the property of their respective owners.