Build Instructions
The build processes uses configure and make. Make sure that you have make
and a supported compiler installed.
Download the latest source archive from Source Forge and extract it somewhere on your machine. You can also use the command line to do this.
wget -O libucx.tgz https://sourceforge.net/projects/ucx/files/latest tar -xzf libucx.tgz cd libucxConfigure the build according to your preferences. You can get a list of all available options with
./configure --help
. The recommended configuration for production builds is./configure --release
../configure --release make make check sudo make install
Download the latest source archive from Source Forge and extract it somewhere on your machine.
Navigate to the folder named
msvc
in the extracted directory structure.Open the contained
ucx.sln
in Visual Studio and build the solution.The libucx project in the solution will produce a libucx.lib that can be used for static linking and the libucx_dll project will produce a libucx.dll and a libucx.dll.lib import lib for dynamic linking.
Compile Time Options
When compiling UCX, you can tweak several compile time variables via macro definitions.
Features Defines
The following macros are not defined by default. The effect when they are defined in described in the table.
Macro | Effect |
---|---|
CX_NO_SZMUL_BUILTINT | By default, UCX uses a compiler builtin (only available for clang and gcc) to perform multiplications with overflow check. When this macro is defined, using the builtin is disabled and UCX will always use an own implementation. |
CX_WINDLL | Define this macro during compilation of the project that is using UCX as a Windows DLL to import the symbols. In general it is recommended to use UCX as a static library under Windows, though. |
CX_WINDLL_EXPORT | Define this macro during compilation of UCX to export symbols for a Windows DLL. |
Small Buffer Optimizations
With the following macros you can control the size of stack memory for small buffer optimizations.
Macro | Description | Default |
---|---|---|
CX_ARRAY_SWAP_SBO_SIZE | The maximum size of an element in an array list that can be swapped without allocating heap memory. | 128 |
CX_LINKED_LIST_SORT_SBO_SIZE | The maximum list size that uses SBO during sort. | 1024 |
CX_PRINTF_SBO_SIZE | The maximum string length functions in printf.h use stack memory for. | 512 |
CX_STRSTR_SBO_SIZE | The maximum length of the "needle" in cx_strstr that can use SBO. | 128 |
Other Buffers
With the following macros you can control other buffer sizes that are not falling into the category of small buffer optimizations.
Macro | Description | Default |
---|---|---|
CX_STRREPLACE_INDEX_BUFFER_SIZE | The number of matches the index buffer can store on the stack. If the function finds more matches, more index buffers of the same size are allocated on the heap. | 64 |
CX_STREAM_COPY_BUF_SIZE | The buffer size on the stack for a stream copy. | 1024 |
CX_STREAM_BCOPY_BUF_SIZE | The buffer size on the heap for a stream copy. | 8192 |