libUTL++
|
libUTL++ is a home for code that I've reused across C++ projects over the years.
Here's a brief (incomplete) overview of what's in the library:
dynamic_cast<>
) super::
(unfortunately missing from C++) for
and <algorithms>
) libUTL++ is licensed under the GNU GPL. Make sure you read and understand the license, because it describes your rights in connection with the use and redistribution of this software.
libUTL++ also bundles randutils.hpp by Melissa E. O'Neill, which she has shared under the MIT License. randutils
"makes good seeding easier, and makes using RNGs easy while retaining all the power". In my own words: Melissa's work builds on top of the standard library's RNG facilities to provide easy access to good RNG. The STL's RNG facilities only seem "over-engineered" when there is no convenient wrapper for them. Also, std::random_device
can't be depended on to provide a good seed, even though it may seem at first glance to be suitable for that purpose. I hope to see randutils
(or something much like it) adopted into the standard library in the future.
A few links for randutils
:
std::this_thread
) Currently Linux and Windows/MinGW amd64 targets are supported, as these are the platforms I've targeted in my projects. The library should also work for those systems on x86 (32-bit), but I haven't been testing that myself lately. Not many people care about 32-bit anymore.
You will need the following packages to build the library:
You need these installed when building for Linux:
The MinGW-w64 project has made it easy to cross-compile for Windows on the Linux platform. The included build configuration for MinGW-w64 assumes the cross-targeted binutils & g++ compiler are accessible in the system PATH and named with the prefix x86_64-w64-mingw32-
. For example, on my Debian system I installed the package g++-mingw-w64
, and the MinGW-targeted g++ is named x86_64-w64-mingw32-g++
.
First, unpack the sources and change into the libUTL++ source root:
Next, if you're building on a system other than Linux (such as MinGW), you have to configure the build system for that target by using the config shell script located in the makefiles
directory:
Then build and install libUTL++:
You can use INST_ROOT to override the installation root. For example:
The build process may take a few minutes. Several versions of the library will be built, including:
DEBUG
: libutl_g.a, libutl_g.so.1 -g
, enabled runtime assertions and debug new/delete] DEBUG_RELEASE
: libutl_gr.a, libutl_gr.so.1 -g
, disabled runtime assertions and debug new/delete] RELEASE
: libutl.a, libutl.so.1 -Ofast
, disabled runtime assertions and debug new/delete]To use libUTL++ in your project:
#include
<libutl/libutl.h>
near the start of your source files #include'ing
any other header files from libUTL++) If you subclass utl::Application, it will take care of the utl::init() and utl::deInit() calls for you.
To learn the library, the best way to get started is to study the bundled applications and example programs (installed in $INST_ROOT/share/libutl/
), as well as the documentation (installed in $INST_ROOT/share/doc/libutl-doc/
).
libUTL++ should be able to happily coexist with other libraries:
utl
namespace UTL_
One thing to watch for is that in a DEBUG build, libUTL++ overloads the new operator to keep track of active allocations (remembering the source file and line # where they were made). This can be a problem when including some C++ header files. You can solve it this way:
You can reach me via e-mail: adam@ acms proje ct.o rg
Please contact me if you've found a bug, or if you have any ideas for improving the library.